-
Notifications
You must be signed in to change notification settings - Fork 333
264 lines (230 loc) · 9.79 KB
/
Copy pathpublish.yml
File metadata and controls
264 lines (230 loc) · 9.79 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
name: Publish
# This workflow publishes all WASI proposals to GitHub Container Registry
# when a release is created
on:
release:
types: [published]
workflow_dispatch:
inputs:
version:
description: 'Version to publish (without the v)'
required: true
type: string
wit_dir:
description: 'WIT directory to publish from (wit or wit-0.3.0-draft)'
required: true
type: choice
options:
- wit
- wit-0.3.0-draft
default: wit
jobs:
# Determine version and configuration
setup:
runs-on: ubuntu-latest
outputs:
version: ${{ steps.version.outputs.version }}
wit_dir: ${{ steps.config.outputs.wit_dir }}
is_prerelease: ${{ steps.config.outputs.is_prerelease }}
steps:
- name: Get version from release tag
id: version
run: |
if [ "${{ github.event_name }}" == "release" ]; then
# Extract version from tag (remove 'v' prefix)
VERSION="${{ github.event.release.tag_name }}"
VERSION="${VERSION#v}"
else
VERSION="${{ inputs.version }}"
fi
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
echo "Publishing version: $VERSION"
- name: Determine configuration
id: config
run: |
VERSION="${{ steps.version.outputs.version }}"
# Determine configuration based on version:
# - RC versions always use wit-0.3.0-draft
# - Stable versions use wit (or workflow_dispatch input if provided)
if [[ "$VERSION" == *"-rc-"* ]]; then
IS_PRERELEASE="true"
WIT_DIR="wit-0.3.0-draft"
elif [ "${{ github.event_name }}" == "workflow_dispatch" ] && [ -n "${{ inputs.wit_dir }}" ]; then
IS_PRERELEASE="false"
WIT_DIR="${{ inputs.wit_dir }}"
else
IS_PRERELEASE="false"
WIT_DIR="wit"
fi
{
echo "is_prerelease=$IS_PRERELEASE"
echo "wit_dir=$WIT_DIR"
} >> "$GITHUB_OUTPUT"
# Publish proposals sequentially in dependency order:
# 1. io, random (no WASI dependencies)
# 2. clocks (depends on io)
# 3. filesystem, sockets (depend on io, clocks)
# 4. cli (depends on io, clocks, filesystem, random, sockets)
# 5. http (depends on cli, clocks, io)
publish-io:
needs: setup
# Skip io for P3 prereleases (no wit-0.3.0-draft directory)
if: needs.setup.outputs.is_prerelease != 'true'
uses: ./.github/workflows/publish-proposal.yml
with:
proposal: io
description: "WASI I/O interfaces for streams and poll"
version: ${{ needs.setup.outputs.version }}
wit_dir: ${{ needs.setup.outputs.wit_dir }}
secrets: inherit
publish-random:
needs: setup
uses: ./.github/workflows/publish-proposal.yml
with:
proposal: random
description: "WASI random number generation interfaces"
version: ${{ needs.setup.outputs.version }}
wit_dir: ${{ needs.setup.outputs.wit_dir }}
secrets: inherit
publish-clocks:
needs: [setup, publish-io, publish-random]
# For prereleases, only wait on random (io is skipped)
if: always() && !failure() && !cancelled()
uses: ./.github/workflows/publish-proposal.yml
with:
proposal: clocks
description: "WASI clock interfaces for monotonic and system clocks"
version: ${{ needs.setup.outputs.version }}
wit_dir: ${{ needs.setup.outputs.wit_dir }}
secrets: inherit
publish-filesystem:
needs: [setup, publish-clocks]
if: always() && !failure() && !cancelled()
uses: ./.github/workflows/publish-proposal.yml
with:
proposal: filesystem
description: "WASI filesystem interfaces"
version: ${{ needs.setup.outputs.version }}
wit_dir: ${{ needs.setup.outputs.wit_dir }}
secrets: inherit
publish-sockets:
needs: [setup, publish-clocks]
if: always() && !failure() && !cancelled()
uses: ./.github/workflows/publish-proposal.yml
with:
proposal: sockets
description: "WASI socket interfaces for TCP and UDP"
version: ${{ needs.setup.outputs.version }}
wit_dir: ${{ needs.setup.outputs.wit_dir }}
secrets: inherit
publish-cli:
needs: [setup, publish-filesystem, publish-sockets]
if: always() && !failure() && !cancelled()
uses: ./.github/workflows/publish-proposal.yml
with:
proposal: cli
description: "WASI CLI interfaces for command-line programs"
version: ${{ needs.setup.outputs.version }}
wit_dir: ${{ needs.setup.outputs.wit_dir }}
secrets: inherit
publish-http:
needs: [setup, publish-cli]
if: always() && !failure() && !cancelled()
uses: ./.github/workflows/publish-proposal.yml
with:
proposal: http
description: "WASI HTTP interfaces for HTTP client and server"
version: ${{ needs.setup.outputs.version }}
wit_dir: ${{ needs.setup.outputs.wit_dir }}
secrets: inherit
# Validate all packages were published successfully
validate:
needs: [setup, publish-io, publish-random, publish-clocks, publish-filesystem, publish-sockets, publish-cli, publish-http]
if: always() && !failure() && !cancelled()
runs-on: ubuntu-latest
steps:
- name: Install oras
uses: oras-project/setup-oras@22ce207df3b08e061f537244349aac6ae1d214f6 # v1.2.4
- name: Validate published packages
run: |
VERSION="${{ needs.setup.outputs.version }}"
IS_PRERELEASE="${{ needs.setup.outputs.is_prerelease }}"
# io is excluded from RC releases
if [ "$IS_PRERELEASE" == "true" ]; then
PROPOSALS="random clocks filesystem sockets cli http"
else
PROPOSALS="io random clocks filesystem sockets cli http"
fi
echo "Validating packages for version $VERSION..."
FAILED=""
for proposal in $PROPOSALS; do
echo "Checking ghcr.io/webassembly/wasi/$proposal:$VERSION..."
if oras manifest fetch "ghcr.io/webassembly/wasi/$proposal:$VERSION" > /dev/null 2>&1; then
echo " ✓ $proposal published successfully"
else
echo " ✗ $proposal NOT FOUND"
FAILED="$FAILED $proposal"
fi
done
if [ -n "$FAILED" ]; then
echo ""
echo "ERROR: Failed to validate packages:$FAILED"
exit 1
fi
echo ""
echo "✓ All packages validated successfully!"
# Create specification entry after all publishes complete
create-specification:
needs: [setup, validate]
runs-on: ubuntu-latest
if: needs.setup.outputs.is_prerelease == 'false'
permissions:
contents: write
pull-requests: write
steps:
- name: Checkout repository
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
- name: Create specification directory
run: |
VERSION="${{ needs.setup.outputs.version }}"
SPEC_DIR="specifications/wasi-$VERSION"
mkdir -p "$SPEC_DIR"
cat > "$SPEC_DIR/Overview.md" << EOF
# WASI Specification v${VERSION}
This is version ${VERSION} of the WASI specification, based on the [WebAssembly
Component Model][cm].
## Proposals
The [WebAssembly Interface Type (WIT)][wit] definitions for the proposals included in this
version of the specification are pushed to OCI based on the [Wasm OCI Artifact
layout][wasm-oci]:
- [wasi:io@${VERSION}](https://github.com/WebAssembly/WASI/pkgs/container/wasi%2Fio?tag=${VERSION})
- [wasi:random@${VERSION}](https://github.com/WebAssembly/WASI/pkgs/container/wasi%2Frandom?tag=${VERSION})
- [wasi:clocks@${VERSION}](https://github.com/WebAssembly/WASI/pkgs/container/wasi%2Fclocks?tag=${VERSION})
- [wasi:sockets@${VERSION}](https://github.com/WebAssembly/WASI/pkgs/container/wasi%2Fsockets?tag=${VERSION})
- [wasi:filesystem@${VERSION}](https://github.com/WebAssembly/WASI/pkgs/container/wasi%2Ffilesystem?tag=${VERSION})
- [wasi:cli@${VERSION}](https://github.com/WebAssembly/WASI/pkgs/container/wasi%2Fcli?tag=${VERSION})
- [wasi:http@${VERSION}](https://github.com/WebAssembly/WASI/pkgs/container/wasi%2Fhttp?tag=${VERSION})
[cm]: https://github.com/WebAssembly/component-model
[wit]: https://github.com/WebAssembly/component-model/blob/main/design/mvp/WIT.md
[wasm-oci]: https://tag-runtime.cncf.io/wgs/wasm/deliverables/wasm-oci-artifact
EOF
# Remove leading whitespace from heredoc
sed -i 's/^ //' "$SPEC_DIR/Overview.md"
- name: Create Pull Request for specification
uses: peter-evans/create-pull-request@98357b18bf14b5342f975ff684046ec3b2a07725 # v8.0.0
with:
commit-message: "Add specification for v${{ needs.setup.outputs.version }}"
branch: spec-v${{ needs.setup.outputs.version }}
title: "Add specification for WASI v${{ needs.setup.outputs.version }}"
body: |
This PR adds the specification entry for WASI v${{ needs.setup.outputs.version }}.
The following packages have been published to GHCR:
- `ghcr.io/webassembly/wasi/io:${{ needs.setup.outputs.version }}`
- `ghcr.io/webassembly/wasi/random:${{ needs.setup.outputs.version }}`
- `ghcr.io/webassembly/wasi/clocks:${{ needs.setup.outputs.version }}`
- `ghcr.io/webassembly/wasi/sockets:${{ needs.setup.outputs.version }}`
- `ghcr.io/webassembly/wasi/filesystem:${{ needs.setup.outputs.version }}`
- `ghcr.io/webassembly/wasi/cli:${{ needs.setup.outputs.version }}`
- `ghcr.io/webassembly/wasi/http:${{ needs.setup.outputs.version }}`
base: main
delete-branch: true