Skip to content

ci: add github workflow2 #2

ci: add github workflow2

ci: add github workflow2 #2

Workflow file for this run

name: Build plugin
on:
push:
branches: [main, master]
tags: ['**']
pull_request:
branches: [main, master]
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: checkout repo
uses: actions/checkout@v4
# - name: Install pnpm
# uses: pnpm/action-setup@v4
# with:
# version: 10.10.0
- name: env use node.js
uses: actions/setup-node@v4
with:
node-version: '22'
# cache: pnpm
- name: build
run: |
# pnpm install --frozen-lockfile
pnpm 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.AnyBlockPro_Repo }}
name: 'Release ${{ github.ref_name }}'
body: 'Release for tag ${{ github.ref_name }}'
artifacts: |
./dist/main.js
generateReleaseNotes: false # 自动根据 commits 生成 release notes。此外,这里应该导向一个更新日志页
prerelease: true # 是否预发布 (可以在release上修改该项,我就不判断tag是否beta结尾了)
makeLatest: false # 是否最后一个版本 (可以在release上修改该项,我就不判断tag是否beta结尾了)
allowUpdates: true # 如果 tag 已存在,允许更新