From 49549d03aa4bcef904aaf29215f85dcb1ffda1d9 Mon Sep 17 00:00:00 2001 From: Ryan Wang Date: Wed, 6 Nov 2024 15:00:00 +0800 Subject: [PATCH] chore: update cd.yaml --- .github/workflows/cd.yaml | 77 +++++++++++++++++++++++++++++++++------ 1 file changed, 66 insertions(+), 11 deletions(-) diff --git a/.github/workflows/cd.yaml b/.github/workflows/cd.yaml index 6e663cc..c0c4ccc 100644 --- a/.github/workflows/cd.yaml +++ b/.github/workflows/cd.yaml @@ -6,14 +6,69 @@ on: - published jobs: - cd: - uses: halo-sigs/reusable-workflows/.github/workflows/plugin-cd.yaml@v2 - secrets: - halo-pat: ${{ secrets.HALO_PAT }} - permissions: - contents: write - with: - app-id: app-NRcGw - node-version: "20" - pnpm-version: "9" - ui-path: "ui" + build: + name: Build + runs-on: ubuntu-latest + if: github.event_name == 'release' + steps: + - uses: actions/checkout@v4 + - name: Setup Environment + uses: halo-sigs/reusable-workflows/plugin-setup-env@main + with: + cache-dept-path: ui/pnpm-lock.yaml + skip-node-setup: false + node-version: 20 + pnpm-version: 9 + java-version: 17 + - name: Build + run: | + version=${{ github.event.release.tag_name }} + ./gradlew -Pversion=${version#v} build -x check + env: + UNSPLASH_API_KEY: ${{ secrets.UNSPLASH_API_KEY }} + PEXELS_API_KEY: ${{ secrets.PEXELS_API_KEY }} + PIXABAY_API_KEY: ${{ secrets.PIXABAY_API_KEY }} + - name: Upload Artifacts + uses: actions/upload-artifact@v4 + with: + name: artifacts + path: build/libs + retention-days: 1 + + github-release: + name: GitHub Release + runs-on: ubuntu-latest + needs: build + if: github.event_name == 'release' + steps: + - uses: actions/checkout@v4 + - name: Download Artifacts + uses: actions/download-artifact@v4 + with: + name: artifacts + path: build/libs + - name: Upload Release Assets + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: gh release upload ${{ github.event.release.tag_name }} build/libs/* + appstore-release: + name: App Store Release + runs-on: ubuntu-latest + needs: build + if: github.event_name == 'release' + steps: + - uses: actions/checkout@v4 + - name: Download Artifacts + uses: actions/download-artifact@v4 + with: + name: artifacts + path: build/libs + - name: Release to App Store + uses: halo-sigs/app-store-release-action@v3 + with: + github-token: ${{secrets.GITHUB_TOKEN}} + app-id: app-JxVVb + halo-backend-baseurl: https://www.halo.run + release-id: ${{ github.event.release.id }} + assets-dir: build/libs + halo-pat: ${{ secrets.HALO_PAT }}