Skip to content

Commit 76912ba

Browse files
authored
feature: add release workflow (#658)
1 parent 84ddca1 commit 76912ba

File tree

2 files changed

+74
-0
lines changed

2 files changed

+74
-0
lines changed

.github/workflows/release.yaml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: WASI release
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
wasi_version:
7+
description: 'WASI version (without the v)'
8+
required: true
9+
default: '0.2.5'
10+
11+
permissions:
12+
contents: write
13+
pull-requests: write
14+
15+
jobs:
16+
build:
17+
runs-on: ubuntu-latest
18+
steps:
19+
- name: Checkout repository
20+
uses: actions/checkout@v4
21+
with:
22+
fetch-depth: 0 # Needed for PRs and full history
23+
- name: Install cargo-binstall
24+
uses: cargo-bins/[email protected]
25+
- name: Install wit-bindgen
26+
shell: bash
27+
run: cargo binstall -y wit-bindgen-cli wit-deps-cli
28+
29+
30+
- name: Run WASI deps script
31+
run: ./scripts/wasi-deps.sh "${{ github.event.inputs.wasi_version }}"
32+
33+
- name: Create Pull Request
34+
uses: peter-evans/create-pull-request@v7
35+
with:
36+
commit-message: "Release WASI v${{ github.event.inputs.wasi_version }}"
37+
branch: release-v${{ github.event.inputs.wasi_version }}
38+
title: "Release WASI v${{ github.event.inputs.wasi_version }}"
39+
body: |
40+
Release v${{ inputs.wasi_version }}.
41+
base: main
42+
delete-branch: true
43+

scripts/wasi-deps.sh

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#!/usr/bin/env bash
2+
set -e
3+
4+
# Sanitize VERSION: remove leading "v" if present
5+
RAW_VERSION="$1"
6+
VERSION="${RAW_VERSION#v}"
7+
8+
# Check that VERSION matches semver (e.g., 1.2.3)
9+
if ! [[ "$VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
10+
echo "Error: VERSION must be in semver format (e.g., 1.2.3 or v1.2.3)"
11+
exit 1
12+
fi
13+
14+
echo "io = \"https://github.com/WebAssembly/wasi-io/archive/v${VERSION}.tar.gz\"
15+
random = \"https://github.com/WebAssembly/wasi-random/archive/v${VERSION}.tar.gz\"
16+
clocks = \"https://github.com/WebAssembly/wasi-clocks/archive/v${VERSION}.tar.gz\"
17+
filesystem = \"https://github.com/WebAssembly/wasi-filesystem/archive/v${VERSION}.tar.gz\"
18+
sockets = \"https://github.com/WebAssembly/wasi-sockets/archive/v${VERSION}.tar.gz\"
19+
cli = \"https://github.com/WebAssembly/wasi-cli/archive/v${VERSION}.tar.gz\"
20+
http = \"https://github.com/WebAssembly/wasi-http/archive/v${VERSION}.tar.gz\"" > deps.toml
21+
22+
wit-deps -d wasip2 -m deps.toml -l deps.lock
23+
rm deps.toml
24+
rm deps.lock
25+
26+
# Update wasip2/README.md with the new version
27+
if [ -f wasip2/README.md ]; then
28+
echo "Updating wasip2/README.md with version ${VERSION}"
29+
sed -i.bak -E "s/[0-9]+\.[0-9]+\.[0-9]+/${VERSION}/g" wasip2/README.md
30+
rm wasip2/README.md.bak
31+
fi

0 commit comments

Comments
 (0)