From ee514a8c9574b81c486f5a5413e6703a8fe06f4a Mon Sep 17 00:00:00 2001 From: Wanxp <977741432@qq.com> Date: Sun, 9 Mar 2025 12:24:08 +0800 Subject: [PATCH] =?UTF-8?q?enhance=20=E5=A2=9E=E5=8A=A0=E6=8F=90=E4=BA=A4?= =?UTF-8?q?=E5=8F=91=E5=B8=83=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/release.yml | 75 +++++++++++++++++++++++++++++++++++ 1 file changed, 75 insertions(+) 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..d4d735c --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,75 @@ +name: Release + +on: + push: + paths: + - 'manifest.json' + +jobs: + build: + runs-on: ubuntu-latest + environment: node18 + + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Set up Node.js + uses: actions/setup-node@v3 + with: + node-version: '18' + + - name: Install dependencies + run: npm install + + - name: Build project + run: npm run build + + - name: Extract version from package.json + id: extract_version + run: echo "VERSION=$(jq -r '.version' package.json)" >> $GITHUB_ENV + + - name: Create tag + run: git tag -a "v${{ env.VERSION }}" -m "Release version ${{ env.VERSION }}" + + - name: Push tag + run: git push origin "v${{ env.VERSION }}" + + - name: Create GitHub release + id: create_release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: "v${{ env.VERSION }}" + release_name: "${{ env.VERSION }}" + draft: false + prerelease: true + body: ${{ github.event.head_commit.message }} + + - name: Upload release assets + uses: actions/upload-release-asset@v1 + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: ./main.js + asset_name: main.js + asset_content_type: application/javascript + + - name: Upload manifest.json + uses: actions/upload-release-asset@v1 + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: ./manifest.json + asset_name: manifest.json + asset_content_type: application/json + + - name: Upload style.css + uses: actions/upload-release-asset@v1 + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: ./style.css + asset_name: style.css + asset_content_type: text/css + + - name: Output release message + run: echo "发布预发布版本${{ env.VERSION }}正常" \ No newline at end of file