Skip to content

v2.2.1

v2.2.1 #70

Workflow file for this run

name: NPM Publish
on:
release:
# This specifies that the build will be triggered when we publish a release
types:
- published
jobs:
publish:
name: Publish to NPM & Create Pull Request of Version Update
# Run on latest version of ubuntu
runs-on: ubuntu-latest
permissions:
id-token: write
contents: write
pull-requests: write
steps:
- uses: actions/checkout@v2
with:
# "ref" specifies the branch to check out.
# "github.event.release.target_commitish" is a global variable and specifies the branch the release targeted
ref: ${{ github.event.release.target_commitish }}
# install Node.js
- name: Use Node.js 16
uses: actions/setup-node@v1
with:
node-version: 18
# Specifies the registry, this field is required!
registry-url: https://registry.npmjs.org/
# clean install of your projects' deps. We use "npm ci" to avoid package lock changes
- run: npm install -g npm@latest
- run: npm install
# set up git since we will later push to the repo
- run: git config --global user.name "Artus Version Bot"
- run: git config --global user.email "[email protected]"
- run: git status
- run: git diff
# upgrade npm version in package.json to the tag used in the release.
# upgrade npm version in package.json to the tag used in the release.
- run: npm version ${{ github.event.release.tag_name }} --allow-same-version
# build the project
- run: npm run build
# run tests just in case
- run: npm test
# publish to NPM -> there is one caveat, continue reading for the fix
- run: npm publish --provenance --access public
if: "!github.event.release.prerelease"
env:
# Use a token to publish to NPM. See below for how to set it up
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- run: npm publish --provenance --access public --tag beta
if: "github.event.release.prerelease"
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Create Pull Request
uses: peter-evans/create-pull-request@v4
with:
title: "[Version] ${{ github.event.release.tag_name }}"