Skip to content

Commit 2f05d66

Browse files
authored
ci: upload wit tar for releases (#877)
* ci: upload wit tar for releases Add new job to create and upload a wasi-wit-VERSION.tar.gz artifact to GitHub releases containing consolidated WIT files for each proposal. Note each proposal will include it's deps. These are duplicated across proposals to keep each proposal self-contained. Closes #875 * ci: bump wkg to 0.14
1 parent 7e64351 commit 2f05d66

4 files changed

Lines changed: 65 additions & 11 deletions

File tree

.github/actions/install-tools/action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ inputs:
99
wasm-tools-version:
1010
description: 'Version of wasm-tools to install'
1111
required: false
12-
default: '1.242.0'
12+
default: '1.244.0'
1313

1414
runs:
1515
using: 'composite'

.github/workflows/publish-proposal.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ on:
2525
description: 'Version of wkg to install'
2626
required: false
2727
type: string
28-
default: '0.13.0'
28+
default: '0.14.0'
2929

3030
jobs:
3131
publish:
@@ -41,7 +41,7 @@ jobs:
4141
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
4242

4343
- name: Install cargo-binstall
44-
uses: cargo-bins/cargo-binstall@80aaafe04903087c333980fa2686259ddd34b2d9 # v1.16.6
44+
uses: cargo-bins/cargo-binstall@ec80feb9e330418e014932e5982599255eff6dbb # v1.17.4
4545

4646
- name: Install wkg
4747
shell: bash

.github/workflows/publish.yml

Lines changed: 59 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ jobs:
3030
version: ${{ steps.version.outputs.version }}
3131
wit_dir: ${{ steps.config.outputs.wit_dir }}
3232
is_prerelease: ${{ steps.config.outputs.is_prerelease }}
33+
proposals: ${{ steps.config.outputs.proposals }}
3334
steps:
3435
- name: Get version from release tag
3536
id: version
@@ -55,17 +56,21 @@ jobs:
5556
if [[ "$VERSION" == *"-rc-"* ]]; then
5657
IS_PRERELEASE="true"
5758
WIT_DIR="wit-0.3.0-draft"
59+
PROPOSALS="random clocks filesystem sockets cli http"
5860
elif [ "${{ github.event_name }}" == "workflow_dispatch" ] && [ -n "${{ inputs.wit_dir }}" ]; then
5961
IS_PRERELEASE="false"
6062
WIT_DIR="${{ inputs.wit_dir }}"
63+
PROPOSALS="io random clocks filesystem sockets cli http"
6164
else
6265
IS_PRERELEASE="false"
6366
WIT_DIR="wit"
67+
PROPOSALS="io random clocks filesystem sockets cli http"
6468
fi
6569
6670
{
6771
echo "is_prerelease=$IS_PRERELEASE"
6872
echo "wit_dir=$WIT_DIR"
73+
echo "proposals=$PROPOSALS"
6974
} >> "$GITHUB_OUTPUT"
7075
7176
# Publish proposals sequentially in dependency order:
@@ -165,14 +170,7 @@ jobs:
165170
- name: Validate published packages
166171
run: |
167172
VERSION="${{ needs.setup.outputs.version }}"
168-
IS_PRERELEASE="${{ needs.setup.outputs.is_prerelease }}"
169-
170-
# io is excluded from RC releases
171-
if [ "$IS_PRERELEASE" == "true" ]; then
172-
PROPOSALS="random clocks filesystem sockets cli http"
173-
else
174-
PROPOSALS="io random clocks filesystem sockets cli http"
175-
fi
173+
PROPOSALS="${{ needs.setup.outputs.proposals }}"
176174
177175
echo "Validating packages for version $VERSION..."
178176
FAILED=""
@@ -196,6 +194,59 @@ jobs:
196194
echo ""
197195
echo "✓ All packages validated successfully!"
198196
197+
# Create and upload wit.tar.gz artifact to the GitHub release
198+
upload-wit-tarball:
199+
needs: [setup, validate]
200+
runs-on: ubuntu-latest
201+
permissions:
202+
contents: write
203+
steps:
204+
- name: Checkout repository
205+
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
206+
207+
- name: Install cargo-binstall
208+
uses: cargo-bins/cargo-binstall@ec80feb9e330418e014932e5982599255eff6dbb # v1.17.4
209+
210+
- name: Install wkg and wasm-tools
211+
run: |
212+
cargo binstall -y wkg@0.14.0
213+
cargo binstall -y wasm-tools@1.244.0
214+
215+
- name: Create consolidated WIT directory
216+
run: |
217+
VERSION="${{ needs.setup.outputs.version }}"
218+
WIT_DIR="${{ needs.setup.outputs.wit_dir }}"
219+
PROPOSALS="${{ needs.setup.outputs.proposals }}"
220+
TARBALL_DIR="wasi-wit-$VERSION"
221+
222+
mkdir -p "$TARBALL_DIR"
223+
224+
# Build each proposal to .wasm, then extract consolidated WIT
225+
for proposal in $PROPOSALS; do
226+
echo "Building $proposal..."
227+
(cd "proposals/$proposal" && wkg wit build -o "$GITHUB_WORKSPACE/$proposal.wasm" --wit-dir "$WIT_DIR")
228+
mkdir -p "$TARBALL_DIR/$proposal"
229+
wasm-tools component wit "$proposal.wasm" --out-dir "$TARBALL_DIR/$proposal/"
230+
rm "$proposal.wasm"
231+
done
232+
233+
echo "Created $TARBALL_DIR with contents:"
234+
find "$TARBALL_DIR" -type f | head -20
235+
236+
- name: Create tarball
237+
run: |
238+
VERSION="${{ needs.setup.outputs.version }}"
239+
tar -czvf "wasi-wit-$VERSION.tar.gz" "wasi-wit-$VERSION"
240+
echo "Created wasi-wit-$VERSION.tar.gz"
241+
ls -lh "wasi-wit-$VERSION.tar.gz"
242+
243+
- name: Upload to GitHub Release
244+
env:
245+
GH_TOKEN: ${{ github.token }}
246+
run: |
247+
VERSION="${{ needs.setup.outputs.version }}"
248+
gh release upload "v$VERSION" "wasi-wit-$VERSION.tar.gz" --clobber
249+
199250
# Create specification entry after all publishes complete
200251
create-specification:
201252
needs: [setup, validate]

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,6 @@ tmp/
44
# wit-deps vendored dependencies
55
proposals/*/wit/deps/
66
proposals/*/wit-0.3.0-draft/deps/
7+
8+
# Lock files
9+
wkg.lock

0 commit comments

Comments
 (0)