Skip to content

chore: default config: minify #3

chore: default config: minify

chore: default config: minify #3

Workflow file for this run

name: Build plugin
on:
push:
branches: [main, master]
tags: ['**']
pull_request:
branches: [main, master]
workflow_dispatch:
jobs:
build:
name: Build Plugin
runs-on: ubuntu-latest
steps:
- name: checkout repo
uses: actions/checkout@v4
- name: env use node.js
uses: actions/setup-node@v4
with:
node-version: '22'
- name: build
run: |
npm install
npm run build
- name: upload build artifact
if: always()
uses: actions/upload-artifact@v4
with:
name: plugin-build
path: |
dist/main.js
create-release:
name: Create Release
if: github.event_name == 'push' # no pr
needs: [build]
runs-on: ubuntu-latest
steps:
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: ./dist
- name: List downloaded artifacts
run: |
echo "Listing contents of ./dist:"
ls -R ./dist
- name: Create Release
if: startsWith(github.ref, 'refs/tags/')
uses: ncipollo/release-action@v1
with:
token: ${{ secrets.Your_token_secrets_name }} # GitHub Token,不填报错: `Error: Error undefined: Parameter token or opts.auth is required`
name: 'Release ${{ github.ref_name }}'
body: 'Release for tag ${{ github.ref_name }}'
artifacts: |
./dist/main.js
generateReleaseNotes: false # 自动根据 commits 生成 release notes。此外,这里应该导向一个更新日志页
prerelease: ${{ endsWith(github.ref_name, 'beta') }} # 是否预发布
makeLatest: ${{ !endsWith(github.ref_name, 'beta') }} # 是否最后一个版本
allowUpdates: true # 如果 tag 已存在,允许更新