Merge pull request #13 from fails-components/dependabot/npm_and_yarn/… #28
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://help.github.com/actions/language-and-framework-guides/publishing-nodejs-packages | |
name: Node.js Package publish on github | |
on: | |
push: | |
branches: | |
- 'master' | |
workflow_dispatch: | |
inputs: | |
logLevel: | |
description: 'Log level' | |
required: true | |
default: 'warning' | |
tags: | |
description: 'Testing node.js package publish workflow' | |
jobs: | |
publish-gpr: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
with: | |
submodules: true | |
- uses: actions/setup-node@v2 | |
with: | |
node-version: 16 | |
registry-url: https://npm.pkg.github.com/ | |
- name: Check if version has been updated | |
id: check | |
uses: EndBug/version-check@v1 | |
with: | |
diff-search: true | |
- name: Log when changed | |
if: steps.check.outputs.changed == 'true' | |
run: 'echo "Version change found in commit ${{ steps.check.outputs.commit }}! New version: ${{ steps.check.outputs.version }} (${{ steps.check.outputs.type }})"' | |
- name: Log when unchanged | |
if: steps.check.outputs.changed == 'false' | |
run: 'echo "No version change :/"' | |
- name: Install | |
if: steps.check.outputs.changed == 'true' | |
run: npm ci --ignore-scripts=true | |
- run: npm publish --tag stable | |
if: ${{ steps.check.outputs.changed == 'true' && github.ref == 'refs/heads/master' }} | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- run: npm publish --tag next | |
if: ${{ steps.check.outputs.changed == 'true' && github.ref == 'refs/heads/next' }} | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- run: npm dist-tag add @fails-components/webtransport-ponyfill-websocket@${{ steps.check.outputs.version }} latest | |
if: ${{ steps.check.outputs.changed == 'true' && github.ref == 'refs/heads/master' }} | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- run: npm dist-tag add @fails-components/webtransport-ponyfill-websocket@${{ steps.check.outputs.version }} latestunstable | |
if: ${{ steps.check.outputs.changed == 'true' && github.ref == 'refs/heads/next' }} | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |