From a78fe3e6331e42ce39b3f65b9a310d3700e741da Mon Sep 17 00:00:00 2001 From: Innei Date: Thu, 7 Aug 2025 15:56:02 +0800 Subject: [PATCH] chore: temporarily back to the original release logic Signed-off-by: Innei --- .github/workflows/build-android.yml | 7 +- .github/workflows/build-desktop.yml | 6 +- .github/workflows/build-ios.yml | 2 +- .github/workflows/tag.yml | 111 ++++++++++------------------ 4 files changed, 46 insertions(+), 80 deletions(-) diff --git a/.github/workflows/build-android.yml b/.github/workflows/build-android.yml index b8e3126e7..c102ba4a7 100644 --- a/.github/workflows/build-android.yml +++ b/.github/workflows/build-android.yml @@ -92,15 +92,16 @@ jobs: id: version uses: ./.github/actions/setup-version with: - type: "mobile" + # We don't want to create a new release for mobile + type: "desktop" - name: Create Release Draft if: github.event.inputs.release == 'true' uses: softprops/action-gh-release@v2 with: - name: Mobile v${{ steps.version.outputs.APP_VERSION }} + name: v${{ steps.version.outputs.APP_VERSION }} draft: false prerelease: true - tag_name: mobile/v${{ steps.version.outputs.APP_VERSION }} + tag_name: v${{ steps.version.outputs.APP_VERSION }} # .aab cannot be installed directly on your Android Emulator or device. files: ${{ github.workspace }}/build.apk diff --git a/.github/workflows/build-desktop.yml b/.github/workflows/build-desktop.yml index 0c737b225..d13502e41 100644 --- a/.github/workflows/build-desktop.yml +++ b/.github/workflows/build-desktop.yml @@ -222,7 +222,7 @@ jobs: apps/desktop/out/make/**/latest.yml retention-days: 90 - - uses: signpath/github-action-submit-signing-request@v1.3 + - uses: signpath/github-action-submit-signing-request@v1.2 continue-on-error: true if: runner.os == 'windows' && env.RELEASE == 'true' with: @@ -297,10 +297,10 @@ jobs: if: env.RELEASE == 'true' uses: softprops/action-gh-release@v2 with: - name: Desktop v${{ steps.version.outputs.APP_VERSION }} + name: v${{ steps.version.outputs.APP_VERSION }} draft: false prerelease: true - tag_name: desktop/v${{ steps.version.outputs.APP_VERSION }} + tag_name: v${{ steps.version.outputs.APP_VERSION }} files: | apps/desktop/out/make/**/Folo-*.dmg apps/desktop/out/make/**/Folo-*.zip diff --git a/.github/workflows/build-ios.yml b/.github/workflows/build-ios.yml index 43b76b75e..24334ea0b 100644 --- a/.github/workflows/build-ios.yml +++ b/.github/workflows/build-ios.yml @@ -1,4 +1,4 @@ -name: 🍎 Build iOS +name: Build iOS on: push: diff --git a/.github/workflows/tag.yml b/.github/workflows/tag.yml index 489ab634f..b2df7f891 100644 --- a/.github/workflows/tag.yml +++ b/.github/workflows/tag.yml @@ -4,90 +4,55 @@ on: push: branches: - main - +env: + NODE_OPTIONS: --max-old-space-size=8192 jobs: create_tag: - name: Create Release Tag runs-on: ubuntu-latest - outputs: - tag_version: ${{ env.tag_version }} - platform: ${{ env.platform }} - version: ${{ env.version }} - steps: - name: Checkout repository uses: actions/checkout@v4 - - - name: Setup Node.js + - name: Use Node.js uses: actions/setup-node@v4 with: - node-version: lts/* + node-version: 22 - - name: Make script executable + - name: Extract SemVer using Node.js + id: extract_semver run: | - chmod +x .github/scripts/extract-release-info.mjs + node -e ' + const execSync = require("child_process").execSync; + const fs = require("fs"); + const commitMessage = execSync("git log -1 --pretty=%B").toString("utf-8"); + const semverRegex = /release\(desktop\): Release (v[0-9]+\.[0-9]+\.[0-9]+(-[0-9A-Za-z-.]+)?)/; + const match = commitMessage.match(semverRegex); + if (match) { + fs.appendFileSync(process.env.GITHUB_ENV, `tag_version=${match[1]}\n`); + } else { + console.log("No SemVer found in commit body."); + process.exit(0); + } + ' - - name: Extract release information - id: extract_info - run: .github/scripts/extract-release-info.mjs - continue-on-error: false - - - name: Validate git configuration - if: env.tag_version + - name: Create a new tag + if: ${{ env.tag_version }} run: | - git config --global user.name "github-actions[bot]" - git config --global user.email "github-actions[bot]@users.noreply.github.com" - - - name: Create and push tag - if: env.tag_version + git tag ${{ env.tag_version }} + git push origin ${{ env.tag_version }} + - name: Trigger Build Desktop Workflow + if: ${{ env.tag_version }} run: | - echo "Creating tag: ${{ env.tag_version }}" - if git rev-parse "${{ env.tag_version }}" >/dev/null 2>&1; then - echo "Tag ${{ env.tag_version }} already exists, skipping creation" - exit 0 - fi + curl -X POST \ + -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ + -H "Accept: application/vnd.github+json" \ + https://api.github.com/repos/${{ github.repository }}/actions/workflows/build-desktop.yml/dispatches \ + -d '{"ref":"main", "inputs": {"tag_version": "true"}}' - git tag "${{ env.tag_version }}" - git push origin "${{ env.tag_version }}" - echo "Successfully created and pushed tag: ${{ env.tag_version }}" - - trigger_builds: - name: Trigger Platform Builds - needs: create_tag - if: needs.create_tag.outputs.tag_version - runs-on: ubuntu-latest - - steps: - - name: Trigger Desktop Build - if: needs.create_tag.outputs.platform == 'desktop' - uses: actions/github-script@v7 - with: - github-token: ${{ secrets.GITHUB_TOKEN }} - script: | - const response = await github.rest.actions.createWorkflowDispatch({ - owner: context.repo.owner, - repo: context.repo.repo, - workflow_id: 'build-desktop.yml', - ref: 'main', - inputs: { - tag_version: 'true' - } - }); - console.log('Desktop build triggered successfully'); - - - name: Trigger Mobile Build - if: needs.create_tag.outputs.platform == 'mobile' - uses: actions/github-script@v7 - with: - github-token: ${{ secrets.GITHUB_TOKEN }} - script: | - const response = await github.rest.actions.createWorkflowDispatch({ - owner: context.repo.owner, - repo: context.repo.repo, - workflow_id: 'build-android.yml', - ref: 'main', - inputs: { - release: 'true' - } - }); - console.log('Mobile build triggered successfully'); + - name: Trigger Build Android Workflow + if: ${{ env.tag_version }} + run: | + curl -X POST \ + -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ + -H "Accept: application/vnd.github+json" \ + https://api.github.com/repos/${{ github.repository }}/actions/workflows/build-android.yml/dispatches \ + -d '{"ref":"main", "inputs": {"release": "true"}}'