-
Notifications
You must be signed in to change notification settings - Fork 339
72 lines (57 loc) · 2.18 KB
/
build-release.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
71
72
name: 'RELEASE: Build release'
on:
workflow_dispatch:
inputs:
version:
description: 'New version number eg: 5.3.1'
required: true
type: string
permissions:
contents: write
pull-requests: write
jobs:
build-release:
name: Build release
runs-on: Ubuntu-22.04
steps:
- name: Checkout
uses: actions/[email protected]
- name: Setup Node
uses: actions/[email protected]
with:
node-version-file: .nvmrc
- name: Install dependencies
run: npm ci
- name: Validate version
uses: actions/[email protected]
with:
script: |
const { validateVersion } = await import('${{ github.workspace }}/.github/workflows/scripts/changelog-release-helper.mjs')
validateVersion('${{ inputs.version }}')
- name: Update package version
run: npm version --no-git-tag-version --workspace govuk-frontend ${{ inputs.version }}
- name: Update CHANGELOG
uses: actions/[email protected]
with:
script: |
const { updateChangelog } = await import('${{ github.workspace }}/.github/workflows/scripts/changelog-release-helper.mjs')
updateChangelog('${{ inputs.version }}')
- name: Generate release notes
uses: actions/[email protected]
with:
script: |
const { generateReleaseNotes } = await import('${{ github.workspace }}/.github/workflows/scripts/changelog-release-helper.mjs')
generateReleaseNotes()
- name: Build release
run: npm run build:release
- name: Create pull request
env:
GH_TOKEN: ${{ secrets.CI_PAT }}
run: |
git config --global user.name '${{ github.actor }}'
git config --global user.email '${{ github.actor }}@digital.cabinet-office.gov.uk'
git add .
git commit -m "Release ${{ inputs.version }}"
git checkout -b release-${{ inputs.version }}
git push -u origin release-${{ inputs.version }}
gh pr create --base main --head release-${{ inputs.version }} --title "Release ${{ inputs.version }}" --body-file "release-notes-body"