You want to deploy on merges to master, but think that can be a bit noisy. This action compares the version in package.json to see if the local one is higher and you can then deploy.
Here's an example of it in action:
name: Deploy to npm
on:
push:
branches:
- main
- master
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
registry-url: 'https://registry.npmjs.org'
# Ensure everything is set up right
- run: 'yarn install'
- run: 'yarn build'
- run: 'yarn test'
- uses: orta/npm-should-deploy-action@master
id: check
- run: 'npm publish'
if: ${{ steps.check.outputs.deploy == 'true' }}
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
Basically a simpler version of orta/monorepo-deploy-nightly
for single package repos.
Actions are run from GitHub repos so we will check-in the packed dist folder.
Then run ncc and push the results:
$ npm run package
$ git add dist
$ git commit -a -m "prod dependencies"
$ git push origin releases/v1
Your action is now published! ๐
See the versioning documentation