Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
xingsy97 committed Dec 2, 2023
1 parent 570573a commit 677c3ab
Showing 1 changed file with 58 additions and 0 deletions.
58 changes: 58 additions & 0 deletions .github/workflows/build-and-release.yml
Original file line number Diff line number Diff line change
@@ -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 }}

0 comments on commit 677c3ab

Please sign in to comment.