From 10c95441a87c65904881c7dbdab8e046ef6d704d Mon Sep 17 00:00:00 2001 From: luxiaobei Date: Tue, 3 Feb 2026 14:10:35 +0800 Subject: [PATCH] build: add release workflow --- .github/workflows/release.yml | 82 +++++++++++++++++++++++++++++++++++ package.json | 5 ++- 2 files changed, 86 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..b5e1acd --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,82 @@ +name: Publish + +on: + pull_request: + types: + - opened + - reopened + pull_request_review: + types: + - submitted + check_suite: + types: + - completed + status: {} + +jobs: + autoApprove: + if: startsWith(github.head_ref, 'release-auto-') + runs-on: ubuntu-latest + permissions: + pull-requests: write + steps: + - uses: hmarr/auto-approve-action@v4 + with: + review-message: 'Auto approve sync PRs to auto merge them' + publish: + if: startsWith(github.head_ref, 'release-auto-') + needs: [autoApprove] + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + ref: ${{ github.head_ref }} + - name: Setup Node.js + uses: actions/setup-node@v1 + with: + node-version: 24 + registry-url: 'https://registry.npmjs.org' + - name: Install dependencies + run: yarn install + - name: Publish + if: startsWith(github.head_ref, 'release-auto-v') + run: | + git config user.name github-actions + git config user.email github-actions@github.com + yarn pub + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + - name: Publish-next + if: startsWith(github.head_ref, 'release-auto-next-v') + run: | + git config user.name github-actions + git config user.email github-actions@github.com + yarn pub-next + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + - name: Read package.json + id: read-version + uses: notiz-dev/github-action-json-property@release + with: + path: 'package.json' + prop_path: 'version' + - name: send message to webhook + uses: joelwmale/webhook-action@master + with: + url: 'https://hook-rc.pingcode.com/api/flow/w/http/357bdd4f00f34bfab2f878ad3b9e8b48' + body: '{ "version": "${{ steps.read-version.outputs.prop }}", "name": "tethys-pro" }' + autoMerge: + if: startsWith(github.head_ref, 'release-auto-') + needs: [publish] + runs-on: ubuntu-latest + steps: + - id: autoMerge + name: autoMerge + uses: 'pascalgn/automerge-action@v0.15.5' + env: + GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}' + MERGE_LABELS: '' + MERGE_FORKS: 'false' + MERGE_RETRIES: '20' + MERGE_RETRY_SLEEP: '60000' diff --git a/package.json b/package.json index b40ac75..5275320 100644 --- a/package.json +++ b/package.json @@ -14,7 +14,10 @@ "lint": "ng lint", "prepare": "husky install", "pretty": "pretty-quick", - "release": "wpm release", + "release-manual": "wpm release", + "release": "wpm release --release-branch-format release-auto-v{{version}}", + "release-next-manual": "wpm release --release-branch-format release-next-v{{version}}", + "release-next": "wpm release --release-branch-format release-auto-next-v{{version}}", "pub": "wpm publish && npm run pub-only", "pub-only": "cd ./dist/store && npm publish", "pub-next": "wpm publish && npm run pub-only-next",