-
Notifications
You must be signed in to change notification settings - Fork 0
301 lines (276 loc) · 9.27 KB
/
Copy pathrelease.yml
File metadata and controls
301 lines (276 loc) · 9.27 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
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
name: Release / Publish
on:
push:
tags: ['v*']
workflow_dispatch:
inputs:
version:
description: 'Version (e.g. 1.0.1) — used when dispatched manually for a dry-run.'
required: true
type: string
dry_run:
description: 'Skip actual publication to registries (still builds and uploads artifacts).'
required: false
type: boolean
default: true
env:
CARGO_TERM_COLOR: always
jobs:
resolve:
name: resolve version
runs-on: ubuntu-latest
outputs:
version: ${{ steps.v.outputs.version }}
dry_run: ${{ steps.v.outputs.dry_run }}
steps:
- id: v
shell: bash
run: |
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
echo "version=${{ inputs.version }}" >> "$GITHUB_OUTPUT"
echo "dry_run=${{ inputs.dry_run }}" >> "$GITHUB_OUTPUT"
else
echo "version=${GITHUB_REF#refs/tags/v}" >> "$GITHUB_OUTPUT"
echo "dry_run=false" >> "$GITHUB_OUTPUT"
fi
build-binaries:
needs: resolve
uses: ./.github/workflows/build-binaries.yml
with:
version: ${{ needs.resolve.outputs.version }}
github-release:
name: GitHub Release
needs: [resolve, build-binaries]
if: needs.resolve.outputs.dry_run != 'true'
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
path: dist
pattern: binaries-*
merge-multiple: true
- name: Generate combined SHA256SUMS
run: |
cd dist
ls -la
sha256sum *.tar.gz *.zip 2>/dev/null > SHA256SUMS || true
cat SHA256SUMS
- uses: softprops/action-gh-release@v2
with:
tag_name: v${{ needs.resolve.outputs.version }}
name: v${{ needs.resolve.outputs.version }}
generate_release_notes: true
files: |
dist/*.tar.gz
dist/*.zip
dist/SHA256SUMS
publish-crates:
name: Publish to crates.io
needs: resolve
runs-on: ubuntu-latest
permissions:
id-token: write
contents: read
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- name: Authenticate with crates.io (OIDC trusted publishing)
id: cargo-auth
if: needs.resolve.outputs.dry_run != 'true'
uses: rust-lang/crates-io-auth-action@v1
- name: cargo publish pcf
shell: bash
run: |
if [ "${{ needs.resolve.outputs.dry_run }}" = "true" ]; then
cargo publish -p pcf --allow-dirty --dry-run
else
cargo publish -p pcf --allow-dirty --token "${{ steps.cargo-auth.outputs.token }}"
fi
- name: Wait for crates.io index
if: needs.resolve.outputs.dry_run != 'true'
run: sleep 45
- name: cargo publish pcf-sig
shell: bash
run: |
if [ "${{ needs.resolve.outputs.dry_run }}" = "true" ]; then
cargo publish -p pcf-sig --allow-dirty --dry-run
else
cargo publish -p pcf-sig --allow-dirty --token "${{ steps.cargo-auth.outputs.token }}"
fi
- name: Wait for crates.io index
if: needs.resolve.outputs.dry_run != 'true'
run: sleep 45
- name: cargo publish pfs-ms
shell: bash
run: |
if [ "${{ needs.resolve.outputs.dry_run }}" = "true" ]; then
cargo publish -p pfs-ms --allow-dirty --dry-run
else
cargo publish -p pfs-ms --allow-dirty --token "${{ steps.cargo-auth.outputs.token }}"
fi
- name: Wait for crates.io index
if: needs.resolve.outputs.dry_run != 'true'
run: sleep 45
- name: cargo publish pcf-dcp
shell: bash
run: |
if [ "${{ needs.resolve.outputs.dry_run }}" = "true" ]; then
cargo publish -p pcf-dcp --allow-dirty --dry-run
else
cargo publish -p pcf-dcp --allow-dirty --token "${{ steps.cargo-auth.outputs.token }}"
fi
- name: Wait for crates.io index
if: needs.resolve.outputs.dry_run != 'true'
run: sleep 45
- name: cargo publish pcf-debug
shell: bash
run: |
if [ "${{ needs.resolve.outputs.dry_run }}" = "true" ]; then
cargo publish -p pcf-debug --allow-dirty --dry-run
else
cargo publish -p pcf-debug --allow-dirty --token "${{ steps.cargo-auth.outputs.token }}"
fi
- name: Wait for crates.io index
if: needs.resolve.outputs.dry_run != 'true'
run: sleep 45
- name: cargo publish pcf-compact
shell: bash
run: |
if [ "${{ needs.resolve.outputs.dry_run }}" = "true" ]; then
cargo publish -p pcf-compact --allow-dirty --dry-run
else
cargo publish -p pcf-compact --allow-dirty --token "${{ steps.cargo-auth.outputs.token }}"
fi
publish-npm:
name: Publish to npm
needs: resolve
runs-on: ubuntu-latest
permissions:
id-token: write
contents: read
defaults:
run:
working-directory: implementations/ts
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 22
cache: npm
cache-dependency-path: implementations/ts/package-lock.json
registry-url: 'https://registry.npmjs.org'
- name: Ensure npm >= 11.5.1 (trusted publishing support)
run: npm install -g npm@latest
- run: npm ci
- run: npm run build -w @kduma-oss/pcf
- run: npm run build -w @kduma-oss/pcf-sig
- name: npm publish pcf (OIDC trusted publishing, auto-provenance)
run: |
if [ "${{ needs.resolve.outputs.dry_run }}" = "true" ]; then
npm publish -w @kduma-oss/pcf --access public --dry-run
else
npm publish -w @kduma-oss/pcf --access public
fi
- name: npm publish pcf-sig
run: |
if [ "${{ needs.resolve.outputs.dry_run }}" = "true" ]; then
npm publish -w @kduma-oss/pcf-sig --access public --dry-run
else
npm publish -w @kduma-oss/pcf-sig --access public
fi
publish-nuget:
name: Publish to NuGet
needs: resolve
runs-on: ubuntu-latest
permissions:
id-token: write
contents: read
defaults:
run:
working-directory: implementations/dotnet/pcf
steps:
- uses: actions/checkout@v4
- uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.0.x'
- run: dotnet restore
- name: dotnet pack
run: |
dotnet pack src/Pcf/Pcf.csproj \
-c Release \
-p:Version='${{ needs.resolve.outputs.version }}' \
-o out
- name: NuGet login (OIDC trusted publishing)
id: nuget-login
if: needs.resolve.outputs.dry_run != 'true'
uses: NuGet/login@v1
with:
user: krystianduma
- name: dotnet nuget push
if: needs.resolve.outputs.dry_run != 'true'
run: |
dotnet nuget push out/*.nupkg \
--source https://api.nuget.org/v3/index.json \
--api-key '${{ steps.nuget-login.outputs.NUGET_API_KEY }}' \
--skip-duplicate
- name: Dry-run note
if: needs.resolve.outputs.dry_run == 'true'
run: 'echo "Dry-run - skipping dotnet nuget push. Package would be out/*.nupkg."'
- uses: actions/upload-artifact@v4
with:
name: nuget-package
path: implementations/dotnet/pcf/out/*.nupkg
publish-nuget-sig:
name: Publish KDuma.Pcf.Sig to NuGet
needs: [resolve, publish-nuget]
runs-on: ubuntu-latest
permissions:
id-token: write
contents: read
defaults:
run:
working-directory: implementations/dotnet/pcf-sig
steps:
- uses: actions/checkout@v4
- uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.0.x'
- run: dotnet restore
- name: dotnet pack
run: |
dotnet pack src/Pcf.Sig/Pcf.Sig.csproj \
-c Release \
-p:Version='${{ needs.resolve.outputs.version }}' \
-o out
- name: NuGet login (OIDC trusted publishing)
id: nuget-login
if: needs.resolve.outputs.dry_run != 'true'
uses: NuGet/login@v1
with:
user: krystianduma
- name: dotnet nuget push
if: needs.resolve.outputs.dry_run != 'true'
run: |
dotnet nuget push out/*.nupkg \
--source https://api.nuget.org/v3/index.json \
--api-key '${{ steps.nuget-login.outputs.NUGET_API_KEY }}' \
--skip-duplicate
- name: Dry-run note
if: needs.resolve.outputs.dry_run == 'true'
run: 'echo "Dry-run - skipping dotnet nuget push. Package would be out/*.nupkg."'
- uses: actions/upload-artifact@v4
with:
name: nuget-package-sig
path: implementations/dotnet/pcf-sig/out/*.nupkg
split-php:
name: Split PHP to packagist source repo
needs: resolve
if: needs.resolve.outputs.dry_run != 'true'
uses: ./.github/workflows/php-split.yml
with:
tag: v${{ needs.resolve.outputs.version }}
secrets: inherit