mirror of
https://github.com/NeteaseCloudMusicApiEnhanced/api-enhanced.git
synced 2025-10-22 14:43:10 +00:00
Update npm-publish-github-packages.yml
This commit is contained in:
parent
0b706626c8
commit
eadff324d1
@ -1,36 +1,50 @@
|
||||
# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created
|
||||
# For more information see: https://docs.github.com/en/actions/publishing-packages/publishing-nodejs-packages
|
||||
|
||||
name: Node.js Package
|
||||
|
||||
# 触发工作流程的事件
|
||||
on:
|
||||
release:
|
||||
types: [created]
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- "releases/**"
|
||||
- dev
|
||||
|
||||
# 按顺序运行作业
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 20
|
||||
- run: npm ci
|
||||
- run: npm test
|
||||
|
||||
publish-gpr:
|
||||
needs: build
|
||||
# 指定的运行器环境
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: read
|
||||
packages: write
|
||||
# 设置 node 版本
|
||||
strategy:
|
||||
matrix:
|
||||
node-version: [16]
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-node@v4
|
||||
# 拉取 github 仓库代码
|
||||
- uses: actions/checkout@v3
|
||||
# 设定 node 环境
|
||||
- uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: 20
|
||||
registry-url: https://npm.pkg.github.com/
|
||||
- run: npm ci
|
||||
node-version: ${{ matrix.node-version }}
|
||||
# 设置发包 npm 地址仓库
|
||||
registry-url: https://registry.npmjs.org
|
||||
# 安装依赖,相当于 npm ci
|
||||
- name: Install dependencies 📦️
|
||||
run: npm install
|
||||
# 执行构建步骤
|
||||
- name: 构建
|
||||
run: |
|
||||
npm run build
|
||||
# 执行部署
|
||||
- name: 部署
|
||||
# 这个 action 会根据配置自动推送代码到指定分支
|
||||
uses: JamesIves/github-pages-deploy-action@releases/v3
|
||||
with:
|
||||
# 指定密钥,即在第一步中设置的
|
||||
ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }}
|
||||
# 指定推送到的远程分支
|
||||
BRANCH: pages
|
||||
# 指定构建之后的产物要推送哪个目录的代码
|
||||
FOLDER: build
|
||||
- run: npm publish
|
||||
env:
|
||||
NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}
|
||||
# 刚刚设置的 NPM_TOKEN
|
||||
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
|
||||
|
Loading…
x
Reference in New Issue
Block a user