-
Notifications
You must be signed in to change notification settings - Fork 9
171 lines (165 loc) · 6.25 KB
/
Copy pathrelease.yml
File metadata and controls
171 lines (165 loc) · 6.25 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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
name: Release
permissions:
contents: write
id-token: write
on:
push:
tags:
- 'v*'
env:
SKILLD_ROOT_KEY_ID: ${{ vars.SKILLD_ROOT_KEY_ID }}
SKILLD_ROOT_PUBLIC_KEY: ${{ vars.SKILLD_ROOT_PUBLIC_KEY }}
jobs:
release-plan:
runs-on: ubuntu-24.04
outputs:
matrix: ${{ steps.matrix.outputs.value }}
steps:
- uses: actions/checkout@v7
- uses: actions/setup-node@v7
with:
node-version: lts/*
- name: Require the trusted root
shell: bash
run: |
test -n "$SKILLD_ROOT_KEY_ID" || {
echo 'SKILLD_ROOT_KEY_ID is required.' >&2
exit 1
}
test -n "$SKILLD_ROOT_PUBLIC_KEY" || {
echo 'SKILLD_ROOT_PUBLIC_KEY is required.' >&2
exit 1
}
- id: matrix
name: Read native package matrix
shell: bash
run: |
node scripts/release/native-packages.mjs versions "$GITHUB_REF_NAME"
echo "value=$(node scripts/release/native-packages.mjs matrix)" >> "$GITHUB_OUTPUT"
build-native:
needs: release-plan
strategy:
fail-fast: false
matrix: ${{ fromJSON(needs.release-plan.outputs.matrix) }}
runs-on: ${{ matrix.runner }}
steps:
- uses: actions/checkout@v7
- name: Install Rust target
run: rustup target add ${{ matrix.target }}
- name: Install musl tools
if: matrix.libc == 'musl'
shell: bash
run: |
sudo apt-get update
sudo apt-get install --yes musl-tools
- name: Build native CLI
run: cargo build --locked --release --package skilld-native --target ${{ matrix.target }}
env:
CFLAGS: ${{ matrix.cflags }}
- name: Stage native CLI
if: runner.os != 'Windows'
shell: bash
run: |
install -d "staging/${{ matrix.directory }}/bin"
install -m 755 \
"target/${{ matrix.target }}/release/${{ matrix.executable }}" \
"staging/${{ matrix.directory }}/bin/${{ matrix.executable }}"
"staging/${{ matrix.directory }}/bin/${{ matrix.executable }}" --version
tar -cf "${{ matrix.directory }}.tar" -C staging "${{ matrix.directory }}"
- name: Stage native CLI
if: runner.os == 'Windows'
shell: pwsh
run: |
$destination = "staging/${{ matrix.directory }}/bin/${{ matrix.executable }}"
New-Item -ItemType Directory -Force (Split-Path $destination) | Out-Null
Copy-Item "target/${{ matrix.target }}/release/${{ matrix.executable }}" $destination
& $destination --version
tar -cf "${{ matrix.directory }}.tar" -C staging "${{ matrix.directory }}"
- uses: actions/upload-artifact@v7
with:
compression-level: 0
name: ${{ matrix.directory }}
path: ${{ matrix.directory }}.tar
publish:
needs: build-native
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v7
with:
fetch-depth: 0
- uses: pnpm/action-setup@v6
- uses: actions/setup-node@v7
with:
node-version: lts/*
cache: pnpm
registry-url: https://registry.npmjs.org
- id: protocol_release
name: Check independent protocol version
shell: bash
run: |
decision="$(node scripts/release/native-packages.mjs protocol-publish)"
echo "publish=$decision" >> "$GITHUB_OUTPUT"
- uses: actions/download-artifact@v8
with:
path: native-artifacts
- name: Restore native packages
shell: bash
run: |
while IFS= read -r archive; do
tar -xf "$archive" -C packages
done < <(find native-artifacts -type f -name '*.tar' | sort)
- run: pnpm install --frozen-lockfile
- run: pnpm build
- run: pnpm test:run
- id: npm_tag
name: Resolve shared npm tag
shell: bash
run: echo "value=$(node scripts/release/native-packages.mjs npm-tag)" >> "$GITHUB_OUTPUT"
- name: Build JavaScript packages
run: |
pnpm --filter skilld-protocol build
pnpm --filter skilld-harness build
- name: Check native package artifacts
shell: bash
run: |
node scripts/release/native-packages.mjs verify packages
mkdir -p artifacts/native-packages
while IFS= read -r directory; do
pnpm --dir "packages/$directory" pack \
--pack-destination "$GITHUB_WORKSPACE/artifacts/native-packages"
done < <(node scripts/release/native-packages.mjs directories)
node scripts/release/native-packages.mjs verify-packed artifacts/native-packages
- name: Smoke test the installed loader
shell: bash
run: |
expected="skilld $(node -p "require('./package.json').version")"
actual="$(node bin/skilld.mjs --version)"
test "$actual" = "$expected"
- name: Pack the root CLI
run: pnpm pack --pack-destination artifacts
- run: npx changelogithub
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Publish native packages
shell: bash
run: |
while IFS= read -r directory; do
if test "$(node scripts/release/native-packages.mjs package-publish "packages/$directory")" = true; then
pnpm --dir "packages/$directory" publish --access public --no-git-checks --tag "${{ steps.npm_tag.outputs.value }}"
fi
done < <(node scripts/release/native-packages.mjs directories)
- name: Publish root CLI
shell: bash
run: |
if test "$(node scripts/release/native-packages.mjs package-publish .)" = true; then
pnpm publish --access public --no-git-checks --tag "${{ steps.npm_tag.outputs.value }}"
fi
- name: Publish Harness
shell: bash
run: |
if test "$(node scripts/release/native-packages.mjs package-publish packages/harness)" = true; then
pnpm --dir packages/harness publish --access public --no-git-checks --tag "${{ steps.npm_tag.outputs.value }}"
fi
- name: Publish independent protocol
if: steps.protocol_release.outputs.publish == 'true'
run: pnpm --dir packages/protocol publish --access public --no-git-checks