fix: 强制使用 number #20
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 and Publish | |
on: | |
push: | |
branches: | |
- main | |
permissions: | |
contents: write | |
pull-requests: write | |
jobs: | |
release-please: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: google-github-actions/release-please-action@v3 | |
id: release | |
with: | |
release-type: node | |
package-name: kritor-proto | |
default-branch: main | |
# 检出代码 | |
- uses: actions/checkout@v4 | |
if: ${{ steps.release.outputs.release_created }} | |
# 设置 Node.js 环境 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 20 | |
registry-url: 'https://registry.npmjs.org' | |
if: ${{ steps.release.outputs.release_created }} | |
# 初始化子模块 | |
- run: git submodule init | |
if: ${{ steps.release.outputs.release_created }} | |
# 更新子模块 | |
- run: git submodule update --remote | |
if: ${{ steps.release.outputs.release_created }} | |
# 安装 全局安装 protobufjs-cli | |
- run: npm install -g protobufjs-cli | |
if: ${{ steps.release.outputs.release_created }} | |
# 安装依赖 | |
- run: npm install | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.RELEASE }} | |
if: ${{ steps.release.outputs.release_created }} | |
# 构建输出 | |
- run: npm run build | |
if: ${{ steps.release.outputs.release_created }} | |
# 编译ts文件 | |
- run: npx tsc | |
if: ${{ steps.release.outputs.release_created }} | |
# 发布到 npm | |
- run: npm run publish | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
if: ${{ steps.release.outputs.release_created }} |