From 677c3aba672d4dd478fbd599d5fab5dd8151cb9f Mon Sep 17 00:00:00 2001 From: xingsy97 <87063252+xingsy97@users.noreply.github.com> Date: Sat, 2 Dec 2023 09:48:05 +0800 Subject: [PATCH] update --- .github/workflows/build-and-release.yml | 58 +++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 .github/workflows/build-and-release.yml diff --git a/.github/workflows/build-and-release.yml b/.github/workflows/build-and-release.yml new file mode 100644 index 00000000..d0f7e31c --- /dev/null +++ b/.github/workflows/build-and-release.yml @@ -0,0 +1,58 @@ +name: Build and Release + +on: + push: + branches: + - wps # 您的主要分支 + +jobs: + buildAndRelease: + runs-on: ubuntu-latest + env: + GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }} + steps: + - name: Checkout Repository + uses: actions/checkout@v2 + + - name: Setup Node.js + uses: actions/setup-node@v3 + with: + node-version: 18 + + - name: Install Dependencies + run: npm install + + - name: Run Package Script + run: npm run package + + - name: Extract Version from package.json + id: version_step + run: | + package_version=$(node -p "require('./package.json').version") + echo "package_version=${package_version}" >> $GITHUB_OUTPUT + + - name: Set vsix_filename + id: filename_step + run: echo "vsix_filename=$(ls *.vsix)" >> $GITHUB_OUTPUT + + - name: Create Release + id: create_release + uses: actions/create-release@latest + with: + tag_name: ${{ steps.version_step.outputs.package_version }} + release_name: Release ${{ steps.version_step.outputs.package_version }} + body: Release notes for ${{ steps.version_step.outputs.package_version }} + draft: false + prerelease: false + env: + GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }} + + - name: Upload Release Asset + uses: actions/upload-release-asset@v1 + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: ${{ steps.filename_step.outputs.vsix_filename }} + asset_name: ${{ steps.filename_step.outputs.vsix_filename }} + asset_content_type: application/zip + env: + GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }}