-
Notifications
You must be signed in to change notification settings - Fork 0
70 lines (60 loc) · 2.43 KB
/
npm-publish-packages.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
# 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 npmjs
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://registry.npmjs.org/
- 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.NPM_TOKEN }}
- run: npm publish --tag next
if: ${{ steps.check.outputs.changed == 'true' && github.ref == 'refs/heads/next' }}
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_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.NPM_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.NPM_TOKEN }}