ci: github action for release #1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Release Build | ||
on: | ||
push: | ||
branches: | ||
- dev | ||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: write # to be able to publish a GitHub release | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 1 # fetch all history for all tags and branches | ||
ref: dev | ||
- name: setup pnpm | ||
uses: pnpm/action-setup@v2 | ||
with: | ||
version: 9 | ||
- name: Set up Node.js (或其他构建环境) | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: 'lts/*' # 根据需要修改 Node.js 版本 | ||
cache: 'pnpm' # 使用 pnpm 加速安装依赖 | ||
- name: Install dependencies | ||
run: pnpm install | ||
- name: Build project | ||
run: pnpm run bz # 根据项目使用的构建命令修改 | ||
- name: Test | ||
run: echo $GITHUB_WORKSPACE | | ||
pwd | ||
- name: Get version from package.json | ||
id: get_version | ||
run: echo "VERSION=$(jq -r .version package.json)" >> $GITHUB_ENV | ||
- uses: actions/upload-artifact@v4 | ||
with: | ||
Check failure on line 44 in .github/workflows/release.yml GitHub Actions / Release BuildInvalid workflow file
|
||
name: ntab-output | ||
path: ./.output/ntab-${{ env.VERSION }}-chrome.zip # 修改为构建产物的路径 | ||
- name: Create Release | ||
id: create_release | ||
uses: softprops/action-gh-release@v2 | ||
with: | ||
tag_name: v${{ env.VERSION }} # 或者根据需要自定义 tag | ||
release_name: Release ntab ${{ env.VERSION }} | ||
draft: true | ||
prerelease: true | ||
files: ./.output/ntab-${{ env.VERSION }}-chrome.zip # 修改为构建产物的路径 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |