-
Notifications
You must be signed in to change notification settings - Fork 131
77 lines (61 loc) · 2.07 KB
/
release.yml
File metadata and controls
77 lines (61 loc) · 2.07 KB
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
71
72
73
74
75
76
77
name: Create release
on:
push:
tags:
- 'v*'
jobs:
build:
name: Create release
runs-on: ubuntu-latest
permissions:
contents: write
id-token: write
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Checkout
uses: actions/checkout@v5
- name: Setup Node
uses: actions/setup-node@v6
with:
node-version-file: .nvmrc
registry-url: https://registry.npmjs.org/
- name: Install dependencies
run: npm install
- name: Build
run: npm run build
env:
NODE_ENV: production
- name: Run linting
run: npm run lint
- name: Run tests
run: npm test --ignore-scripts
- name: Get package version
id: get_version
run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\/v/}
- name: Create release artifact
run: npm run release --workspace nhsuk-frontend
env:
NPM_PACKAGE_VERSION: ${{ steps.get_version.outputs.VERSION }}
- name: Create release
id: create_release
uses: actions/create-release@v1
with:
tag_name: ${{ github.ref }}
release_name: ${{ github.ref }}
draft: false
prerelease: ${{ contains(steps.get_version.outputs.VERSION, '-') }}
- name: Upload release asset
id: upload-release-asset
uses: actions/upload-release-asset@v1
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./dist/nhsuk-frontend-${{ steps.get_version.outputs.VERSION }}.zip
asset_name: nhsuk-frontend-${{ steps.get_version.outputs.VERSION }}.zip
asset_content_type: application/zip
- name: Publish npm package
if: ${{ !contains(steps.get_version.outputs.VERSION, '-') }}
run: npm publish --workspace nhsuk-frontend --tag latest
- name: Publish npm package (pre-release)
if: ${{ contains(steps.get_version.outputs.VERSION, '-') }}
run: npm publish --workspace nhsuk-frontend --tag next