-
Notifications
You must be signed in to change notification settings - Fork 1
58 lines (50 loc) · 1.42 KB
/
publish-npm.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
name: 'Semver tag, npm version and publish'
on:
pull_request:
types:
- closed
branches:
- main
concurrency:
group: ${{ github.workflow }}
cancel-in-progress: false
jobs:
tag:
name: 'Version, publish and tag'
if: |
github.event.pull_request.merged == true &&
contains(github.event.pull_request.labels.*.name, 'skip-release') == false
runs-on: ubuntu-latest
permissions:
packages: write
contents: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: '20.x'
cache: 'npm'
registry-url: 'https://npm.pkg.github.com'
scope: '@ukhomeoffice'
- name: Install npm dependencies
run: |
npm --loglevel warn ci --ignore-scripts
shell: bash
env:
NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}
- name: Publish npm package
run: |
npm publish
shell: bash
env:
NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}
- name: Extract npm Package Version
run: echo "NPM_VERSION=$(cat package.json | jq -r '.version')" >> ${GITHUB_ENV}
shell: bash
- name: Tag repository
uses: UKHomeOffice/semver-tag-action@v4
with:
tag: ${{ env.NPM_VERSION }}
github_token: ${{ secrets.GITHUB_TOKEN }}