在我的 github 项目中,每当有东西被推送到 master 分支时,我都会尝试自动创建一个新版本并将其发布到 NPM。
这个想法
我正在使用 github 操作。我的工作流程文件如下所示:
# This workflow will run tests using node and then publish a package to the npm registry when a release is created
# For more information see: https://help.github.com/actions/language-and-framework-guides/publishing-nodejs-packages
name: Node.js Package
on:
#trigger on every commit to the main branch
push:
branches:
- main
- master
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: 12
- run: npm test
publish-npm:
needs: build …Run Code Online (Sandbox Code Playgroud) continuous-integration npm github-actions building-github-actions