Skip to content

Commit c2f003c

Browse files
committed
Add ddb-publish bundling action and update release workflows
1 parent ff73805 commit c2f003c

3 files changed

Lines changed: 74 additions & 53 deletions

File tree

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
name: "Bundle ddb-publish"
2+
description: "Build and package the ddb-publish release bundle (ddb-publish-bundle.tgz) from the workspace sources."
3+
4+
inputs:
5+
node-version:
6+
description: "Node.js version to use"
7+
required: true
8+
run-typecheck:
9+
description: "Run workspace typecheck before bundling"
10+
required: false
11+
default: "true"
12+
13+
outputs:
14+
tarball-path:
15+
description: "Path to the generated tarball"
16+
value: ${{ steps.bundle.outputs.tarball_path }}
17+
18+
runs:
19+
using: "composite"
20+
steps:
21+
- name: Set up Node.js
22+
uses: actions/setup-node@v4
23+
with:
24+
node-version: "${{ inputs.node-version }}"
25+
cache: npm
26+
27+
- name: Install dependencies
28+
shell: bash
29+
run: |
30+
set -euo pipefail
31+
npm ci
32+
33+
- name: Generate dependencies
34+
shell: bash
35+
run: |
36+
set -euo pipefail
37+
npm run generate-dependencies --workspaces --if-present
38+
39+
- name: Typecheck
40+
if: inputs.run-typecheck == 'true'
41+
shell: bash
42+
run: |
43+
set -euo pipefail
44+
npm run typecheck --workspaces --if-present
45+
46+
- name: Build ddb-publish bundle
47+
shell: bash
48+
run: |
49+
set -euo pipefail
50+
npm run bundle:release --workspace @supplier-config/ddb-publisher
51+
52+
- name: Smoke-test bundle
53+
shell: bash
54+
run: |
55+
set -euo pipefail
56+
node packages/ddb-publisher/artifacts/ddb-publish/index.cjs --help > /dev/null
57+
58+
- name: Package tarball
59+
id: bundle
60+
shell: bash
61+
run: |
62+
set -euo pipefail
63+
tarball="ddb-publish-bundle.tgz"
64+
tar -czf "$tarball" -C packages/ddb-publisher/artifacts/ddb-publish .
65+
echo "tarball_path=$tarball" >> "$GITHUB_OUTPUT"

.github/workflows/release-ddb-publish.yml

Lines changed: 6 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -22,35 +22,12 @@ jobs:
2222
set -euo pipefail
2323
echo "node=$(grep '^nodejs\s' .tool-versions | awk '{print $2}')" >> "$GITHUB_OUTPUT"
2424
25-
- uses: actions/setup-node@v4
25+
- name: Bundle ddb-publish
26+
id: bundle
27+
uses: ./.github/actions/bundle-ddb-publish
2628
with:
2729
node-version: "${{ steps.versions.outputs.node }}"
28-
cache: npm
29-
30-
- name: Install dependencies
31-
shell: bash
32-
run: |
33-
set -euo pipefail
34-
npm ci
35-
36-
- name: Typecheck
37-
shell: bash
38-
run: |
39-
set -euo pipefail
40-
npm run typecheck --workspaces --if-present
41-
42-
- name: Build ddb-publish bundle
43-
shell: bash
44-
run: |
45-
set -euo pipefail
46-
npm run generate-dependencies --workspaces --if-present
47-
npm run bundle:release --workspace @supplier-config/ddb-publisher
48-
49-
- name: Package release asset
50-
shell: bash
51-
run: |
52-
set -euo pipefail
53-
tar -czf ddb-publish-bundle.tgz -C packages/ddb-publisher/artifacts/ddb-publish .
30+
run-typecheck: "true"
5431

5532
- name: Upload release asset
5633
if: github.event_name == 'release'
@@ -59,11 +36,11 @@ jobs:
5936
shell: bash
6037
run: |
6138
set -euo pipefail
62-
gh release upload "${{ github.event.release.tag_name }}" ddb-publish-bundle.tgz --clobber
39+
gh release upload "${{ github.event.release.tag_name }}" "${{ steps.bundle.outputs.tarball-path }}" --clobber
6340
6441
- name: Upload bundle as workflow artifact
6542
if: github.event_name != 'release'
6643
uses: actions/upload-artifact@v4
6744
with:
6845
name: ddb-publish-bundle
69-
path: ddb-publish-bundle.tgz
46+
path: "${{ steps.bundle.outputs.tarball-path }}"

.github/workflows/stage-3-build.yaml

Lines changed: 3 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -53,32 +53,11 @@ jobs:
5353
- name: "Checkout code"
5454
uses: actions/checkout@v4
5555

56-
- name: "Set up Node.js"
57-
uses: actions/setup-node@v4
56+
- name: "Bundle ddb-publish"
57+
uses: ./.github/actions/bundle-ddb-publish
5858
with:
5959
node-version: "${{ inputs.nodejs_version }}"
60-
cache: npm
61-
62-
- name: "Repo setup"
63-
run: |
64-
npm ci
65-
66-
- name: "Generate dependencies"
67-
run: |
68-
npm run generate-dependencies --workspaces --if-present
69-
70-
- name: "Build bundle"
71-
run: |
72-
npm run bundle:release --workspace @supplier-config/ddb-publisher
73-
74-
- name: "Smoke-test bundle"
75-
run: |
76-
node packages/ddb-publisher/artifacts/ddb-publish/index.cjs --help > /dev/null
77-
78-
- name: "Package tarball"
79-
run: |
80-
tar -czf ddb-publish-bundle.tgz -C packages/ddb-publisher/artifacts/ddb-publish .
81-
tar -tzf ddb-publish-bundle.tgz | head -n 20
60+
run-typecheck: "false"
8261

8362
artefact-1:
8463
name: "Artefact 1"

0 commit comments

Comments
 (0)