Skip to content

Commit 3e99fed

Browse files
authored
fix: publish in dep order (#843)
Despite passing in a local wit-dir for publishing, wkg requires deps to be published to a registry. This changes the workflow to run sequential jobs in dependency order. a. publish-io, publish-random (no deps, run in parallel) b. publish-clocks (waits for io, random) c. publish-filesystem, publish-sockets (wait for clocks, run in parallel) d. publish-cli (waits for filesystem, sockets) e. publish-http (waits for cli) - publish-io is skipped for prereleases (is_prerelease != 'true') - Other jobs use if: always() && !failure() && !cancelled() to handle skipped io gracefully - validate and create-specification updated to depend on all publish jobs
1 parent 6269444 commit 3e99fed

File tree

2 files changed

+168
-93
lines changed

2 files changed

+168
-93
lines changed
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
name: Publish Proposal
2+
3+
# Reusable workflow to publish a single WASI proposal to GHCR
4+
5+
on:
6+
workflow_call:
7+
inputs:
8+
proposal:
9+
description: 'Name of the proposal to publish'
10+
required: true
11+
type: string
12+
description:
13+
description: 'Description of the proposal'
14+
required: true
15+
type: string
16+
version:
17+
description: 'Version to publish'
18+
required: true
19+
type: string
20+
wit_dir:
21+
description: 'WIT directory (wit or wit-0.3.0-draft)'
22+
required: true
23+
type: string
24+
wkg_version:
25+
description: 'Version of wkg to install'
26+
required: false
27+
type: string
28+
default: '0.13.0'
29+
30+
jobs:
31+
publish:
32+
runs-on: ubuntu-latest
33+
permissions:
34+
id-token: write
35+
packages: write
36+
contents: write
37+
attestations: write
38+
39+
steps:
40+
- name: Checkout repository
41+
uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
42+
43+
- name: Install cargo-binstall
44+
uses: cargo-bins/cargo-binstall@3fc81674af4165a753833a94cae9f91d8849049f # v1.16.2
45+
46+
- name: Install wkg
47+
shell: bash
48+
run: cargo binstall -y "wkg@${{ inputs.wkg_version }}"
49+
50+
- name: Login to GitHub Container Registry
51+
uses: docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef # v3.6.0
52+
with:
53+
registry: ghcr.io
54+
username: ${{ github.actor }}
55+
password: ${{ secrets.ORG_PAT }}
56+
57+
- name: Build WIT package
58+
shell: bash
59+
working-directory: proposals/${{ inputs.proposal }}
60+
run: |
61+
echo "Building ${{ inputs.proposal }} from: $(pwd)"
62+
wkg wit build -o "$GITHUB_WORKSPACE/wasi-${{ inputs.proposal }}.wasm" --wit-dir "${{ inputs.wit_dir }}"
63+
64+
- name: Publish to GitHub Container Registry
65+
id: publish
66+
uses: bytecodealliance/wkg-github-action@10b3b04b9059ba46208cd7daf7d352af14bded0f # v5
67+
with:
68+
oci-reference-without-tag: 'ghcr.io/webassembly/wasi/${{ inputs.proposal }}'
69+
file: 'wasi-${{ inputs.proposal }}.wasm'
70+
description: ${{ inputs.description }}
71+
source: 'https://github.com/webassembly/wasi'
72+
homepage: 'https://wasi.dev'
73+
version: ${{ inputs.version }}
74+
licenses: 'Apache-2.0 WITH LLVM-exception'
75+
76+
- name: Attest build provenance
77+
uses: actions/attest-build-provenance@977bb373ede98d70efdf65b84cb5f73e068dcc2a # v3.0.0
78+
with:
79+
subject-name: ghcr.io/webassembly/wasi/${{ inputs.proposal }}
80+
subject-digest: ${{ steps.publish.outputs.digest }}
81+
push-to-registry: true
82+
github-token: ${{ secrets.ORG_PAT }}

.github/workflows/publish.yml

Lines changed: 86 additions & 93 deletions
Original file line numberDiff line numberDiff line change
@@ -68,102 +68,95 @@ jobs:
6868
echo "wit_dir=$WIT_DIR"
6969
} >> "$GITHUB_OUTPUT"
7070
71-
# Publish each proposal
72-
publish:
71+
# Publish proposals sequentially in dependency order:
72+
# 1. io, random (no WASI dependencies)
73+
# 2. clocks (depends on io)
74+
# 3. filesystem, sockets (depend on io, clocks)
75+
# 4. cli (depends on io, clocks, filesystem, random, sockets)
76+
# 5. http (depends on cli, clocks, io)
77+
78+
publish-io:
7379
needs: setup
74-
runs-on: ubuntu-latest
75-
permissions:
76-
id-token: write
77-
packages: write
78-
contents: write
79-
attestations: write
80-
81-
strategy:
82-
fail-fast: false
83-
matrix:
84-
proposal:
85-
- name: io
86-
description: "WASI I/O interfaces for streams and poll"
87-
exclude_for_p3: true
88-
- name: random
89-
description: "WASI random number generation interfaces"
90-
- name: clocks
91-
description: "WASI clock interfaces for monotonic and wall clocks"
92-
- name: filesystem
93-
description: "WASI filesystem interfaces"
94-
- name: sockets
95-
description: "WASI socket interfaces for TCP and UDP"
96-
- name: cli
97-
description: "WASI CLI interfaces for command-line programs"
98-
- name: http
99-
description: "WASI HTTP interfaces for HTTP client and server"
100-
101-
steps:
102-
# Skip proposals marked exclude_for_p3 when publishing prereleases (0.3.0-rc)
103-
- name: Check if should skip
104-
id: skip_check
105-
run: |
106-
if [ "${{ matrix.proposal.exclude_for_p3 }}" == "true" ] && [ "${{ needs.setup.outputs.is_prerelease }}" == "true" ]; then
107-
echo "skip=true" >> "$GITHUB_OUTPUT"
108-
echo "Skipping ${{ matrix.proposal.name }} for P3 prerelease"
109-
else
110-
echo "skip=false" >> "$GITHUB_OUTPUT"
111-
fi
112-
113-
- name: Checkout repository
114-
if: steps.skip_check.outputs.skip != 'true'
115-
uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
116-
117-
- name: Install cargo-binstall
118-
if: steps.skip_check.outputs.skip != 'true'
119-
uses: cargo-bins/cargo-binstall@3fc81674af4165a753833a94cae9f91d8849049f # v1.16.2
120-
121-
- name: Install wkg
122-
if: steps.skip_check.outputs.skip != 'true'
123-
shell: bash
124-
run: cargo binstall -y wkg
125-
126-
- name: Login to GitHub Container Registry
127-
if: steps.skip_check.outputs.skip != 'true'
128-
uses: docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef # v3.6.0
129-
with:
130-
registry: ghcr.io
131-
username: ${{ github.actor }}
132-
password: ${{ secrets.ORG_PAT }}
133-
134-
- name: Build WIT package
135-
if: steps.skip_check.outputs.skip != 'true'
136-
shell: bash
137-
working-directory: proposals/${{ matrix.proposal.name }}
138-
run: |
139-
echo "Building from: $(pwd)"
140-
wkg wit build -o "$GITHUB_WORKSPACE/wasi-${{ matrix.proposal.name }}.wasm" --wit-dir "${{ needs.setup.outputs.wit_dir }}"
141-
142-
- name: Publish to GitHub Container Registry
143-
if: steps.skip_check.outputs.skip != 'true'
144-
id: publish
145-
uses: bytecodealliance/wkg-github-action@10b3b04b9059ba46208cd7daf7d352af14bded0f # v5
146-
with:
147-
oci-reference-without-tag: 'ghcr.io/webassembly/wasi/${{ matrix.proposal.name }}'
148-
file: 'wasi-${{ matrix.proposal.name }}.wasm'
149-
description: ${{ matrix.proposal.description }}
150-
source: 'https://github.com/webassembly/wasi'
151-
homepage: 'https://wasi.dev'
152-
version: ${{ needs.setup.outputs.version }}
153-
licenses: 'Apache-2.0 WITH LLVM-exception'
154-
155-
- name: Attest build provenance
156-
if: steps.skip_check.outputs.skip != 'true'
157-
uses: actions/attest-build-provenance@977bb373ede98d70efdf65b84cb5f73e068dcc2a # v3.0.0
158-
with:
159-
subject-name: ghcr.io/webassembly/wasi/${{ matrix.proposal.name }}
160-
subject-digest: ${{ steps.publish.outputs.digest }}
161-
push-to-registry: true
162-
github-token: ${{ secrets.ORG_PAT }}
80+
# Skip io for P3 prereleases (no wit-0.3.0-draft directory)
81+
if: needs.setup.outputs.is_prerelease != 'true'
82+
uses: ./.github/workflows/publish-proposal.yml
83+
with:
84+
proposal: io
85+
description: "WASI I/O interfaces for streams and poll"
86+
version: ${{ needs.setup.outputs.version }}
87+
wit_dir: ${{ needs.setup.outputs.wit_dir }}
88+
secrets: inherit
89+
90+
publish-random:
91+
needs: setup
92+
uses: ./.github/workflows/publish-proposal.yml
93+
with:
94+
proposal: random
95+
description: "WASI random number generation interfaces"
96+
version: ${{ needs.setup.outputs.version }}
97+
wit_dir: ${{ needs.setup.outputs.wit_dir }}
98+
secrets: inherit
99+
100+
publish-clocks:
101+
needs: [setup, publish-io, publish-random]
102+
# For prereleases, only wait on random (io is skipped)
103+
if: always() && !failure() && !cancelled()
104+
uses: ./.github/workflows/publish-proposal.yml
105+
with:
106+
proposal: clocks
107+
description: "WASI clock interfaces for monotonic and system clocks"
108+
version: ${{ needs.setup.outputs.version }}
109+
wit_dir: ${{ needs.setup.outputs.wit_dir }}
110+
secrets: inherit
111+
112+
publish-filesystem:
113+
needs: [setup, publish-clocks]
114+
if: always() && !failure() && !cancelled()
115+
uses: ./.github/workflows/publish-proposal.yml
116+
with:
117+
proposal: filesystem
118+
description: "WASI filesystem interfaces"
119+
version: ${{ needs.setup.outputs.version }}
120+
wit_dir: ${{ needs.setup.outputs.wit_dir }}
121+
secrets: inherit
122+
123+
publish-sockets:
124+
needs: [setup, publish-clocks]
125+
if: always() && !failure() && !cancelled()
126+
uses: ./.github/workflows/publish-proposal.yml
127+
with:
128+
proposal: sockets
129+
description: "WASI socket interfaces for TCP and UDP"
130+
version: ${{ needs.setup.outputs.version }}
131+
wit_dir: ${{ needs.setup.outputs.wit_dir }}
132+
secrets: inherit
133+
134+
publish-cli:
135+
needs: [setup, publish-filesystem, publish-sockets]
136+
if: always() && !failure() && !cancelled()
137+
uses: ./.github/workflows/publish-proposal.yml
138+
with:
139+
proposal: cli
140+
description: "WASI CLI interfaces for command-line programs"
141+
version: ${{ needs.setup.outputs.version }}
142+
wit_dir: ${{ needs.setup.outputs.wit_dir }}
143+
secrets: inherit
144+
145+
publish-http:
146+
needs: [setup, publish-cli]
147+
if: always() && !failure() && !cancelled()
148+
uses: ./.github/workflows/publish-proposal.yml
149+
with:
150+
proposal: http
151+
description: "WASI HTTP interfaces for HTTP client and server"
152+
version: ${{ needs.setup.outputs.version }}
153+
wit_dir: ${{ needs.setup.outputs.wit_dir }}
154+
secrets: inherit
163155

164156
# Validate all packages were published successfully
165157
validate:
166-
needs: [setup, publish]
158+
needs: [setup, publish-io, publish-random, publish-clocks, publish-filesystem, publish-sockets, publish-cli, publish-http]
159+
if: always() && !failure() && !cancelled()
167160
runs-on: ubuntu-latest
168161
steps:
169162
- name: Install oras
@@ -205,7 +198,7 @@ jobs:
205198
206199
# Create specification entry after all publishes complete
207200
create-specification:
208-
needs: [setup, publish, validate]
201+
needs: [setup, validate]
209202
runs-on: ubuntu-latest
210203
if: needs.setup.outputs.is_prerelease == 'false'
211204
permissions:

0 commit comments

Comments
 (0)