Closed jhechtf closed 3 years ago
Sounds good, if we can setup that for any branch It'll be fine. Please let me know what do I need to do to help you!
You'll need to grab an NPM token with write access from your account (or whatever account owns the YRV package there); I'll setup a verdaccio server to test. Might also be a good time to think about using something like standard-version for releases. I'll see what I can whip up here in a second.
# 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://help.github.com/actions/language-and-framework-guides/publishing-nodejs-packages
name: Node.js Package
on:
release:
types: [created]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: 12
- run: npm ci
- run: npm run lint
publish-npm:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: 12
registry-url: https://registry.npmjs.org/
- run: npm ci
- run: npm publish
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
seems to be the start of what we need. hard to test as i don't want to publish a package to npmjs unnecessarily.
Good enough, I believe we can prove it by using an invalid NPM_TOKEN, thank you!
In double checking I realized this pipeline wouldn't exactly do what we need.
We need to
tags
release
script. It will appropriately bump the version so that we don't get into conflicts with NPM versions.
It would help speed things up if we properly setup actions on the project so that any merges into master are linting, testing, and (if those are passing) building + publishing to NPM.
I've done something similar with Gitlab Pipelines, and Actions appears to have a pre-set thing that we could use, but it would require some setup on your part.