From 0ab5c2310959e1affa1438b128bc7f77be59f9de Mon Sep 17 00:00:00 2001 From: fi3ework Date: Mon, 20 May 2024 14:17:18 +0800 Subject: [PATCH] chore: tweak release workflow --- .github/workflows/release.yaml | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index ae6076a..debe939 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -13,6 +13,8 @@ jobs: steps: - name: Checkout uses: actions/checkout@v4 + with: + fetch-depth: 0 - name: Setup npmrc run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" >> .npmrc @@ -28,9 +30,20 @@ jobs: - name: Install Dependencies and build run: pnpm install + - uses: actions/github-script@v7 + id: version_to_release + with: + result-encoding: string + script: | + const fs = require('fs'); + const packageJson = JSON.parse(fs.readFileSync('./packages/builder-rsbuild/package.json', 'utf8')); + return 'v' + packageJson.version; + - name: Publish to NPM run: | - pnpm changeset publish + git tag ${{ steps.version_to_release.outputs.result }} + git push origin ${{ steps.version_to_release.outputs.result }} + pnpm -r publish - name: GitHub Release run: pnpx changelogithub