Skip to content

v0.1.16-alpha

v0.1.16-alpha #26

Workflow file for this run

# 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:
publish-to-npmjs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 16
registry-url: https://registry.npmjs.org/
- name: Set env
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
- run: npm --no-git-tag-version version ${{ env.RELEASE_VERSION }}
- run: npm ci
- run: npm publish --access=public
env:
NODE_AUTH_TOKEN: ${{secrets.npm_token}}
publish-to-github:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v3
# Setup .npmrc file to publish to GitHub Packages
- uses: actions/setup-node@v3
with:
node-version: '16.x'
registry-url: 'https://npm.pkg.github.com'
# Defaults to the user or organization that owns the workflow file
# scope: '@cisco-developer'
- name: Set env
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
- name: Show tag
run: |
echo $RELEASE_VERSION
echo ${{ env.RELEASE_VERSION }}
- run: npm --no-git-tag-version version ${{ env.RELEASE_VERSION }}
- run: cat package.json
- run: npm ci
# Seems access does not matter for github.
- run: npm publish --access=restricted
# - run: npm publish --access=public
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}