-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
96 lines (82 loc) · 3.15 KB
/
ci-npm-package-build.yaml
File metadata and controls
96 lines (82 loc) · 3.15 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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
name: "Build - Wasp npm packages"
on:
workflow_call:
inputs:
build-outputs-json:
description: "The returned outputs from the build workflow, as a JSON string"
required: true
type: string
override-npm-package-version:
description: >
If set, overrides the version of npm packages to publish.
Useful for publishing an RC version.
Leading 'v' will be stripped if present.
required: false
type: string
env:
WASP_TELEMETRY_DISABLE: 1
jobs:
make-npm-packages:
runs-on: ubuntu-latest
name: Make npm packages
steps:
- uses: actions/checkout@v6
- name: Compute artifact names for download
uses: ./.github/actions/compute-artifact-names
id: compute-download-artifact-names
with:
build-name: all
- uses: actions/download-artifact@v6
with:
path: "./download/"
pattern: ${{ steps.compute-download-artifact-names.outputs.artifact-name }}
- name: Copy artifacts to input folder
run: |
mkdir -p ./input/
cp ./download/${{ steps.compute-download-artifact-names.outputs.artifact-name }}/* ./input/
- name: Create build metadata file
env:
INPUT_DATA_JSON: ${{ inputs.build-outputs-json }}
OVERRIDE_VERSION_JSON: ${{ inputs.override-npm-package-version && toJson(inputs.override-npm-package-version) || 'null' }}
JQ_PROGRAM:
# The schema for this file is at `scripts/make-npm-packages/src/schema/input-data.ts`.
# We'll wrangle the data from the build jobs into that schema here.
|
{
version: ($overrideVersion // $inputData.waspc_version) | ltrimstr("v"),
tarballs:
$inputData
| with_entries(select(.key | startswith("output_")))
| map(
fromjson
| {
fileName: .["tarball-name"],
target: (.["npm-target"] | fromjson)
}
)
}
run: |
jq \
--null-input \
--argjson inputData "$INPUT_DATA_JSON" \
--argjson overrideVersion "$OVERRIDE_VERSION_JSON" \
"$JQ_PROGRAM" \
> ./input/data.json
cat ./input/data.json # For debugging purposes
- uses: actions/setup-node@v6
with:
cache: npm
node-version-file: ".nvmrc"
- name: Install dependencies for script
working-directory: ./scripts/make-npm-packages
run: npm ci
# NOTE: --experimental-strip-types allows Node to run TypeScript
# directly. This flag became the default in Node v22.18+, but we need
# it explicitly for our minimum supported version (v22.12.0).
- name: Run packager script
run: node --experimental-strip-types ./scripts/make-npm-packages/src/index.ts --input-dir ./input/ --output-dir ./output/
- uses: actions/upload-artifact@v5
with:
name: ${{ vars.WASP_NPM_ARTIFACT_NAME }}
include-hidden-files: true
path: ./output/