|
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}}' |
3 | 3 |
|
4 | 4 | on: |
5 | 5 | workflow_dispatch: |
6 | 6 | inputs: |
7 | 7 | environment: |
8 | 8 | description: Environment |
9 | | - required: true |
| 9 | + required: true # For UI consistency with other required options |
10 | 10 | type: choice |
11 | 11 | options: |
12 | 12 | - test |
13 | 13 | - production |
14 | 14 |
|
15 | 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}} |
| 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