Skip to content

Commit 8bfb0f0

Browse files
committed
Try same name so can test on PR
1 parent 4b042b1 commit 8bfb0f0

3 files changed

Lines changed: 71 additions & 71 deletions

File tree

.github/workflows/publish-release.yaml

Lines changed: 0 additions & 20 deletions
This file was deleted.
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
name: 'RELEASE: npm publish'
2+
run-name: 'RELEASE: npm publish to ${{inputs.environment}}'
3+
4+
on:
5+
workflow_dispatch:
6+
inputs:
7+
environment:
8+
description: Environment
9+
required: true
10+
type: choice
11+
options:
12+
- test
13+
- production
14+
15+
jobs:
16+
publish:
17+
name: Publish to npm
18+
runs-on: ubuntu-22.04
19+
environment: ${{ inputs.environment == 'production' && 'production' || null }}
20+
permissions:
21+
id-token: write
22+
23+
steps:
24+
- name: Checkout
25+
uses: actions/checkout@v6.0.2
26+
27+
- name: Setup Node
28+
uses: actions/setup-node@v6.4.0
29+
with:
30+
node-version-file: .nvmrc
31+
registry-url: 'https://registry.npmjs.org'
32+
33+
- name: Install dependencies
34+
run: npm ci
35+
36+
- name: Generate tag
37+
id: generate_tag
38+
run: |
39+
TAG=$(npm run generate-npm-tag --silent)
40+
echo "NPM_TAG=${TAG}" >> $GITHUB_OUTPUT
41+
42+
- name: Build npm package
43+
run: npm run build:package
44+
45+
- name: Print information on package
46+
id: pack
47+
run: |
48+
echo '```bash' >> $GITHUB_STEP_SUMMARY
49+
# Redirect the stderr which contains the useful meta data to the Action summary
50+
ARCHIVE_FILE_PATH=$(npm pack --workspace govuk-frontend 2>> $GITHUB_STEP_SUMMARY)
51+
echo '```' >> $GITHUB_STEP_SUMMARY
52+
53+
echo "ARCHIVE_FILE_PATH=${ARCHIVE_FILE_PATH}" >> $GITHUB_OUTPUT
54+
55+
- name: Upload npm package archive artifact
56+
uses: actions/upload-artifact@v7
57+
with:
58+
path: ${{steps.pack.outputs.ARCHIVE_FILE_PATH}}
59+
archive: false # file is already compressed
60+
61+
- name: Publish to npm
62+
if: inputs.environment == 'production'
63+
run: npm publish --workspace govuk-frontend --provenance --tag ${{steps.generate_tag.outputs.NPM_TAG}}
Lines changed: 8 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1,63 +1,20 @@
1-
name: 'RELEASE: npm publish'
2-
run-name: 'RELEASE: npm publish to ${{inputs.environment}}'
1+
name: 'RELEASE: Publish release (GitHub and npm)'
2+
run-name: 'RELEASE: Publish release (GitHub and npm) to ${{inputs.environment}}'
33

44
on:
55
workflow_dispatch:
66
inputs:
77
environment:
88
description: Environment
9-
required: true
9+
required: true # For UI consistency with other required options
1010
type: choice
1111
options:
1212
- test
1313
- production
1414

1515
jobs:
16-
publish:
17-
name: Publish to npm
18-
runs-on: ubuntu-22.04
19-
environment: ${{ inputs.environment == 'production' && 'production' || null }}
20-
permissions:
21-
id-token: write
22-
23-
steps:
24-
- name: Checkout
25-
uses: actions/checkout@v6.0.2
26-
27-
- name: Setup Node
28-
uses: actions/setup-node@v6.4.0
29-
with:
30-
node-version-file: .nvmrc
31-
registry-url: 'https://registry.npmjs.org'
32-
33-
- name: Install dependencies
34-
run: npm ci
35-
36-
- name: Generate tag
37-
id: generate_tag
38-
run: |
39-
TAG=$(npm run generate-npm-tag --silent)
40-
echo "NPM_TAG=${TAG}" >> $GITHUB_OUTPUT
41-
42-
- name: Build npm package
43-
run: npm run build:package
44-
45-
- name: Print information on package
46-
id: pack
47-
run: |
48-
echo '```bash' >> $GITHUB_STEP_SUMMARY
49-
# Redirect the stderr which contains the useful meta data to the Action summary
50-
ARCHIVE_FILE_PATH=$(npm pack --workspace govuk-frontend 2>> $GITHUB_STEP_SUMMARY)
51-
echo '```' >> $GITHUB_STEP_SUMMARY
52-
53-
echo "ARCHIVE_FILE_PATH=${ARCHIVE_FILE_PATH}" >> $GITHUB_OUTPUT
54-
55-
- name: Upload npm package archive artifact
56-
uses: actions/upload-artifact@v7
57-
with:
58-
path: ${{steps.pack.outputs.ARCHIVE_FILE_PATH}}
59-
archive: false # file is already compressed
60-
61-
- name: Publish to npm
62-
if: inputs.environment == 'production'
63-
run: npm publish --workspace govuk-frontend --provenance --tag ${{steps.generate_tag.outputs.NPM_TAG}}
16+
publish-to-npm:
17+
uses: ./.github/workflows/publish-to-npm-2.yaml
18+
publish-release-to-github:
19+
needs: [publish-to-npm]
20+
uses: ./.github/workflows/publish-release-to-github.yaml

0 commit comments

Comments
 (0)