1.14.4 – maple.3.2 – no-cache #25
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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://docs.github.com/en/actions/publishing-packages/publishing-nodejs-packages | |
name: Node.js Package | |
on: | |
release: | |
types: [created] | |
jobs: | |
build: | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Setup Node.js Env | |
run: echo "NODE_VER=`cat .nvmrc`" >> $GITHUB_ENV | |
- name: Setup Node.js | |
uses: dcodeIO/setup-node-nvm@v4 | |
with: | |
node-version: "${{ env.NODE_VER }}" | |
- name: Install dependencies | |
run: npm ci | |
- name: Create Build | |
run: npm run build | |
publish-npm: | |
needs: build | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Setup Node.js Env | |
run: echo "NODE_VER=`cat .nvmrc`" >> $GITHUB_ENV | |
- name: Setup Node.js | |
uses: dcodeIO/setup-node-nvm@v4 | |
with: | |
node-version: "${{ env.NODE_VER }}" | |
- name: Install dependencies | |
run: npm ci | |
- name: Create Build | |
run: npm run build | |
- run: git config --global user.name "${{ github.actor }}" | |
- run: git config --global user.email "github-action-${{ github.actor }}@users.noreply.github.com" | |
- name: Tag NPM version | |
run: npm version --allow-same-version ${{ github.event.release.tag_name }} | |
# https://stackoverflow.com/questions/38935176/how-to-npm-publish-specific-folder-but-as-package-root | |
- name: Copy `package.json` into `./dist` directory then cd into that folder before publishing to npmjs. | |
run: | | |
cp -f package.json .npmignore .npmrc ./dist | |
cd ./dist | |
npm publish --userconfig .npmrc --registry https://registry.npmjs.org/ | |
env: | |
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} |