From 2502ff7e32700c7547a41e8736691155e069260b Mon Sep 17 00:00:00 2001 From: Horus Date: Sat, 11 Mar 2023 20:35:38 +0800 Subject: [PATCH] feat: modify tauri client release workflow (#1532) --- .github/workflows/client-app.yml | 95 +++++++++++++------------- apps/desktop/src-tauri/tauri.conf.json | 4 +- 2 files changed, 50 insertions(+), 49 deletions(-) diff --git a/.github/workflows/client-app.yml b/.github/workflows/client-app.yml index 5168d9f7a1..516d21cbdb 100644 --- a/.github/workflows/client-app.yml +++ b/.github/workflows/client-app.yml @@ -1,20 +1,12 @@ name: Release App on: - push: - tags: - - 'v*.*.*' - paths-ignore: - - 'README.md' - - 'docs/**' - - '.vscode' - pull_request: - branches: - - master - paths-ignore: - - 'docs/**' - - 'README.md' - - '.vscode' + workflow_dispatch: + inputs: + version: + description: App Vesion + required: false + default: 0.1.0 permissions: actions: write @@ -31,27 +23,29 @@ jobs: create-release: runs-on: ubuntu-latest outputs: - RELEASE_UPLOAD_ID: ${{ steps.create_release.outputs.id }} + release_id: ${{ steps.create-release.outputs.result }} steps: - - uses: actions/checkout@v3 - - name: Query version number - id: get_version - shell: bash - run: | - echo "using version tag ${GITHUB_REF:10}" - echo "version=${GITHUB_REF:10}" >> $GITHUB_ENV - - name: Create Release - id: create_release - if: startsWith(github.ref, 'refs/tags/') - uses: actions/create-release@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - uses: actions/checkout@v2 + - name: setup node + uses: actions/setup-node@v1 with: - draft: true - tag_name: '${{ env.version }}' - release_name: 'AFFiNE ${{ env.version }}' - body: 'See the assets to download this version and install.' + node-version: 16 + - name: create release + id: create-release + uses: actions/github-script@v6 + with: + script: | + const { data } = await github.rest.repos.createRelease({ + owner: context.repo.owner, + repo: context.repo.repo, + tag_name: `affine-client-v${{ github.event.inputs.version }}`, + name: `Affine Client v${{ github.event.inputs.version }}`, + body: 'Take a look at the assets to download and install this app.', + draft: true, + prerelease: false + }) + return data.id build-tauri: needs: create-release @@ -85,24 +79,31 @@ jobs: workspaces: | apps/desktop/src-tauri - - name: Make App Binary - run: pnpm build:client - env: - CI_PULL_REQUEST: ${{ github.event_name == 'pull_request' }} - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - name: Upload to release on git tag Or output artifact path on nightly - uses: tauri-apps/tauri-action@dev + uses: tauri-apps/tauri-action@v0 id: tauri-action env: + CI_PULL_REQUEST: ${{ github.event_name == 'pull_request' }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: - releaseId: ${{ needs.create-release.outputs.RELEASE_UPLOAD_ID }} - - name: Upload artifact - uses: actions/upload-artifact@v3 + releaseId: ${{ needs.create-release.outputs.release_id }} + + publish-release: + runs-on: ubuntu-latest + needs: [create-release, build-tauri] + + steps: + - name: publish pre release + id: publish-pre-release + uses: actions/github-script@v6 + env: + release_id: ${{ needs.create-release.outputs.release_id }} with: - name: tauri-client-app-artifact - path: | - ${{ fromJSON(steps.tauri-action.outputs.artifactPaths)[0] }} - ${{ fromJSON(steps.tauri-action.outputs.artifactPaths)[1] }} - ${{ fromJSON(steps.tauri-action.outputs.artifactPaths)[2] }} + script: | + github.rest.repos.updateRelease({ + owner: context.repo.owner, + repo: context.repo.repo, + release_id: process.env.release_id, + draft: false, + prerelease: true + }) diff --git a/apps/desktop/src-tauri/tauri.conf.json b/apps/desktop/src-tauri/tauri.conf.json index 7826b99c7d..568775bb5d 100644 --- a/apps/desktop/src-tauri/tauri.conf.json +++ b/apps/desktop/src-tauri/tauri.conf.json @@ -7,8 +7,8 @@ "withGlobalTauri": false }, "package": { - "productName": "AFFiNE", - "version": "0.0.2" + "productName": "Affine", + "version": "0.1.0" }, "tauri": { "allowlist": {