Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 7 additions & 12 deletions .github/RELEASE.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,22 +12,17 @@
┌──────────────────────┼──────────────────────┐
▼ ▼ ▼
┌───────── ┌─────────┐ ┌─────────┐
wasi:io │ │wasi:cli │ ... │wasi:http│
│ → GHCR │ → GHCR │ │ → GHCR │
└───────── └─────────┘ └─────────┘
┌───────────┐ ┌─────────┐ ┌─────────┐
│wasi:random│ │wasi:cli │ ... │wasi:http│
│ → GHCR │ → GHCR │ │ → GHCR │
└───────────┘ └─────────┘ └─────────┘

## Usage

The unified `release.sh` script in `.github/scripts/` handles both patch and RC releases:
The `release.sh` script in `.github/scripts/` cuts a WASI 0.3.x release:

```bash
# Patch release (0.2.x stable)
.github/scripts/release.sh --type patch --prev 0.2.8 --next 0.2.9

# RC release (0.3.0-rc-YYYY-MM-DD)
.github/scripts/release.sh --type rc --prev-rc-date 2025-09-16
.github/scripts/release.sh --type rc # First RC, no previous date
.github/scripts/release.sh --prev 0.3.0 --next 0.3.1
```

## What the Script Does
Expand All @@ -37,6 +32,6 @@ The script automates the entire release process:
1. Triggers `release.yml` to bump version numbers and create a PR
2. Waits for the PR to be created and CI to pass
3. Awaits manual review and merge of the PR
4. Creates a GitHub release (with `--prerelease` flag for RC)
4. Creates a GitHub release
5. Waits for `publish.yml` to publish packages to GHCR
6. Validates all packages were published successfully
4 changes: 0 additions & 4 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,6 @@ P-http:
- changed-files:
- any-glob-to-any-file: 'proposals/http/**'

P-io:
- changed-files:
- any-glob-to-any-file: 'proposals/io/**'

P-random:
- changed-files:
- any-glob-to-any-file: 'proposals/random/**'
Expand Down
10 changes: 3 additions & 7 deletions .github/scripts/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,17 @@ Validates WIT definitions for changed proposals. Used by the CI workflow.

```bash
# Validate specific proposals by simulating changed files
WIT_02_FILES='["proposals/cli/wit/cli.wit"]' node .github/scripts/validate-proposals.js

# Validate 0.3 proposals
WIT_03_FILES='["proposals/http/wit-0.3.0-draft/handler.wit"]' node .github/scripts/validate-proposals.js
WIT_FILES='["proposals/cli/wit/command.wit"]' node .github/scripts/validate-proposals.js

# Validate multiple proposals
WIT_02_FILES='["proposals/cli/wit/cli.wit", "proposals/http/wit/proxy.wit"]' node .github/scripts/validate-proposals.js
WIT_FILES='["proposals/cli/wit/command.wit", "proposals/http/wit/worlds.wit"]' node .github/scripts/validate-proposals.js
```

### Environment Variables

| Variable | Description |
|----------|-------------|
| `WIT_02_FILES` | JSON array of changed files in `proposals/*/wit/**` |
| `WIT_03_FILES` | JSON array of changed files in `proposals/*/wit-0.3.0-draft/**` |
| `WIT_FILES` | JSON array of changed files in `proposals/*/wit/**` |

### What it validates

Expand Down
72 changes: 17 additions & 55 deletions .github/scripts/release.sh
Original file line number Diff line number Diff line change
@@ -1,42 +1,34 @@
#!/bin/bash

# Unified release script for WASI releases
# Release script for WASI 0.3.x releases
#
# This script automates the release process for both patch (0.2.x) and RC (0.3.0-rc) releases:
# This script automates the release process:
# 1. Triggers the release.yml workflow to update versions and create PR
# 2. Waits for PR to be filed and CI to pass
# 3. Waits for manual PR review and merge
# 4. Creates a GitHub release to trigger publishing
# 5. Waits for publish workflow to complete (validates packages in CI)
#
# Usage:
# Patch release: ./release.sh --type patch --prev 0.2.8 --next 0.2.9
# RC release: ./release.sh --type rc [--prev-rc-date 2025-09-16]
# ./release.sh --prev 0.3.0 --next 0.3.1

set -e
set -x

# Parse arguments
RELEASE_TYPE=""
PREV_VERSION=""
NEXT_VERSION=""
PREV_RC_DATE=""

while [[ $# -gt 0 ]]; do
case $1 in
--type) RELEASE_TYPE="$2"; shift 2 ;;
--prev) PREV_VERSION="$2"; shift 2 ;;
--next) NEXT_VERSION="$2"; shift 2 ;;
--prev-rc-date) PREV_RC_DATE="$2"; shift 2 ;;
-h|--help)
echo "Usage:"
echo " Patch release: $0 --type patch --prev <prev_version> --next <next_version>"
echo " RC release: $0 --type rc [--prev-rc-date <YYYY-MM-DD>]"
echo " $0 --prev <prev_version> --next <next_version>"
echo ""
echo "Examples:"
echo " $0 --type patch --prev 0.2.8 --next 0.2.9"
echo " $0 --type rc --prev-rc-date 2025-09-16"
echo " $0 --type rc # First RC, no previous date"
echo "Example:"
echo " $0 --prev 0.3.0 --next 0.3.1"
exit 0
;;
*)
Expand All @@ -51,35 +43,17 @@ done
DATE="$(date +'%Y-%m-%d')"
REPO="WebAssembly/WASI"

# Configure based on release type
if [ "$RELEASE_TYPE" == "patch" ]; then
if [ -z "$PREV_VERSION" ] || [ -z "$NEXT_VERSION" ]; then
echo "Error: Patch release requires --prev and --next"
echo "Example: $0 --type patch --prev 0.2.8 --next 0.2.9"
exit 1
fi
TAG="v$NEXT_VERSION"
PRERELEASE_FLAG=""
RELEASE_LABEL="Patch"
elif [ "$RELEASE_TYPE" == "rc" ]; then
NEXT_VERSION="0.3.0-rc-$DATE"
TAG="v$NEXT_VERSION"
PRERELEASE_FLAG="--prerelease"
RELEASE_LABEL="RC"
else
echo "Error: --type must be 'patch' or 'rc'"
echo "Use --help for usage information"
if [ -z "$PREV_VERSION" ] || [ -z "$NEXT_VERSION" ]; then
echo "Error: release requires --prev and --next"
echo "Example: $0 --prev 0.3.0 --next 0.3.1"
exit 1
fi
TAG="v$NEXT_VERSION"

echo "============================================"
echo "WASI $RELEASE_LABEL Release"
echo "WASI Release"
echo "============================================"
if [ "$RELEASE_TYPE" == "patch" ]; then
echo "Previous version: $PREV_VERSION"
else
echo "Previous RC date: ${PREV_RC_DATE:-'(none/first RC)'}"
fi
echo "Previous version: $PREV_VERSION"
echo "Next version: $NEXT_VERSION"
echo "Tag: $TAG"
echo "Repository: $REPO"
Expand All @@ -100,21 +74,9 @@ fi
echo ""
echo "Step 1: Triggering release.yml workflow..."

if [ "$RELEASE_TYPE" == "patch" ]; then
gh workflow run "release.yml" \
-f release_type="patch" \
-f prev_version="$PREV_VERSION" \
-f next_version="$NEXT_VERSION"
else
if [ -n "$PREV_RC_DATE" ]; then
gh workflow run "release.yml" \
-f release_type="rc" \
-f prev_rc_date="$PREV_RC_DATE"
else
gh workflow run "release.yml" \
-f release_type="rc"
fi
fi
gh workflow run "release.yml" \
-f prev_version="$PREV_VERSION" \
-f next_version="$NEXT_VERSION"

# Wait for workflow to start
echo "Waiting for workflow to start..."
Expand Down Expand Up @@ -180,7 +142,7 @@ echo ""
echo "Step 4: Creating GitHub release $TAG..."
sleep 5

gh release create "$TAG" --generate-notes $PRERELEASE_FLAG
gh release create "$TAG" --generate-notes
gh release view "$TAG"

# Step 5: Wait for publish workflow
Expand All @@ -206,5 +168,5 @@ fi

echo ""
echo "============================================"
echo "✓ Release $NEXT_VERSION ($RELEASE_LABEL) completed successfully!"
echo "✓ Release $NEXT_VERSION completed successfully!"
echo "============================================"
40 changes: 16 additions & 24 deletions .github/scripts/validate-proposals.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,6 @@ const { execSync } = require('child_process');
const fs = require('fs');
const { validateDirectory, formatErrors } = require('./validate-since');

const witPath = (proposal, version) => {
if (version === '0.2') return `proposals/${proposal}/wit`;
if (version === '0.3') return `proposals/${proposal}/wit-0.3.0-draft`;
throw new Error(`Unknown version: ${version}`);
};

const parseFiles = (filesJson) => {
if (!filesJson || filesJson === 'null') return [];
try {
Expand Down Expand Up @@ -45,17 +39,7 @@ const run = (cmd) => {
};

// Collect proposals to validate from changed files
const toValidate = [];
const filesByVersion = [
[process.env.WIT_02_FILES, '0.2'],
[process.env.WIT_03_FILES, '0.3'],
];

for (const [filesJson, version] of filesByVersion) {
for (const proposal of extractProposals(parseFiles(filesJson))) {
toValidate.push({ proposal, version });
}
}
const toValidate = extractProposals(parseFiles(process.env.WIT_FILES));

if (toValidate.length === 0) {
console.log('No proposals to validate');
Expand All @@ -64,33 +48,41 @@ if (toValidate.length === 0) {

let failed = false;

for (const { proposal, version } of toValidate) {
const witDir = witPath(proposal, version);
console.log(`::group::Validating ${proposal} v${version}`);
for (const proposal of toValidate) {
const witDir = ((proposal) => `proposals/${proposal}/wit`)(proposal);
console.log(`::group::Validating ${proposal}`);

try {
console.log(` Path: ${witDir}`);

// Skip proposals whose wit/ directory no longer exists. A PR that removes a
// proposal still surfaces its deleted files in the changed-file list, but
// there is nothing left to validate.
if (!fs.existsSync(witDir)) {
console.log(` Skipping ${proposal}: ${witDir} no longer exists (proposal removed)`);
continue;
}

// Check wit-deps lock if deps.toml exists
if (fs.existsSync(`${witDir}/deps.toml`)) {
console.log(' Checking dependencies...');
if (!run(`wit-deps -m "${witDir}"/deps.toml -l "${witDir}"/deps.lock -d "${witDir}"/deps lock --check`)) {
console.log(`::error::wit-deps lock check failed for ${proposal} v${version}`);
console.log(`::error::wit-deps lock check failed for ${proposal}`);
failed = true;
}
}

// Validate WIT syntax
console.log(' Validating WIT...');
if (!run(`wasm-tools component wit "${witDir}" -o /dev/null`)) {
console.log(`::error::WIT validation failed for ${proposal} v${version}`);
console.log(`::error::WIT validation failed for ${proposal}`);
failed = true;
}

// Validate wasm encoding
console.log(' Validating wasm encoding...');
if (!run(`wasm-tools component wit "${witDir}" --wasm -o /dev/null`)) {
console.log(`::error::wasm encoding failed for ${proposal} v${version}`);
console.log(`::error::wasm encoding failed for ${proposal}`);
failed = true;
}

Expand All @@ -99,7 +91,7 @@ for (const { proposal, version } of toValidate) {
const sinceErrors = validateDirectory(witDir);
if (sinceErrors.length > 0) {
console.log(formatErrors(sinceErrors));
console.log(`::error::@since validation failed for ${proposal} v${version}: ${sinceErrors.length} missing annotation(s)`);
console.log(`::error::@since validation failed for ${proposal}: ${sinceErrors.length} missing annotation(s)`);
failed = true;
}
} finally {
Expand Down
2 changes: 1 addition & 1 deletion .github/scripts/validate-since.js
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ if (require.main === module) {

if (args.length === 0) {
console.log('Usage: node validate-since.js <directory>');
console.log('Example: node validate-since.js proposals/io/wit');
console.log('Example: node validate-since.js proposals/clocks/wit');
process.exit(1);
}

Expand Down
13 changes: 4 additions & 9 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,12 @@ on:
branches: [main]
paths:
- 'proposals/**/wit/**'
- 'proposals/**/wit-0.3.0-draft/**'
- '.github/scripts/**'
- '.github/workflows/ci.yml'
pull_request:
branches: [main]
paths:
- 'proposals/**/wit/**'
- 'proposals/**/wit-0.3.0-draft/**'
- '.github/scripts/**'
- '.github/workflows/ci.yml'

Expand All @@ -28,18 +26,15 @@ jobs:
with:
list-files: json
filters: |
wit-02:
wit:
- 'proposals/*/wit/**'
wit-03:
- 'proposals/*/wit-0.3.0-draft/**'

- name: Install tools
if: steps.changes.outputs.wit-02 == 'true' || steps.changes.outputs.wit-03 == 'true'
if: steps.changes.outputs.wit == 'true'
uses: ./.github/actions/install-tools

- name: Validate changed proposals
if: steps.changes.outputs.wit-02 == 'true' || steps.changes.outputs.wit-03 == 'true'
if: steps.changes.outputs.wit == 'true'
run: node .github/scripts/validate-proposals.js
env:
WIT_02_FILES: ${{ steps.changes.outputs.wit-02_files }}
WIT_03_FILES: ${{ steps.changes.outputs.wit-03_files }}
WIT_FILES: ${{ steps.changes.outputs.wit_files }}
2 changes: 1 addition & 1 deletion .github/workflows/publish-proposal.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ on:
required: true
type: string
wit_dir:
description: 'WIT directory (wit or wit-0.3.0-draft)'
description: 'WIT directory'
required: true
type: string
wkg_version:
Expand Down
Loading
Loading