- To use this in a project, create a github/workflows/main.yml in the home directory
- Copy the below code to the above file
name: Publish to NPM
on:
release:
types: [published]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: SFDX Publish Action Step
id: publish-action
uses: jag-sfdc/sfdx-publish-action@master
env:
NPM_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
- Go to "Secrets" tab of your project and add "NPM_AUTH_TOKEN" and the secret from your NPM repository.
- Once the main.yml file is Checked-in, for every release created from github, Actoins would be triggered and uses sfdx-publish-action to publish to NPM repository.
- At the moment, sfdx-publish-action increases the patch version by one for every run. This can be changed and will be made configurable in future.