Skip to content

Commit 7db34a1

Browse files
committed
ci: update, test, publish 0.3.0 workflows
Intentionally keeping these distinct from 0.2.0 to allow for rapid iteration and changes to how we want to release in this next update to wasi.
1 parent 4c8e429 commit 7db34a1

File tree

2 files changed

+150
-0
lines changed

2 files changed

+150
-0
lines changed

.github/workflows/publish-0.3.yml

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
name: Publish 0.3.0 WIT Definitions
2+
3+
# Run this action when changes are pushed to the main branch and affect files in the wit-0.3.0-draft directory
4+
on:
5+
push:
6+
tags:
7+
- v0.3.0-rc-*
8+
workflow_dispatch: # Allow manual triggering
9+
10+
env:
11+
IMAGE_NAME: ${{ github.repository }}
12+
13+
jobs:
14+
publish:
15+
runs-on: ubuntu-latest
16+
permissions:
17+
id-token: write
18+
packages: write
19+
contents: write
20+
21+
steps:
22+
# Checkout the repo and install dependencies
23+
- name: Checkout repository
24+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
25+
26+
- name: Install cargo-binstall
27+
uses: cargo-bins/cargo-binstall@8aac5aa2bf0dfaa2863eccad9f43c68fe40e5ec8 # v1.14.1
28+
29+
- name: Install wkg
30+
shell: bash
31+
run: cargo binstall wkg
32+
33+
- name: Install cosign
34+
uses: sigstore/cosign-installer@d58896d6a1865668819e1d91763c7751a165e159 # v3.9.2
35+
36+
# To version our image we want to obtain the version from the tag
37+
- name: Get version
38+
id: meta
39+
uses: docker/metadata-action@v5
40+
with:
41+
images: ghcr.io/webassembly/wasi/clocks-0.3.0
42+
tags: |
43+
type=semver,pattern={{version}}
44+
45+
- name: Login to the GitHub registry
46+
uses: docker/login-action@74a5d142397b4f367a81961eba4e8cd7edddf772 # v3.4.0
47+
with:
48+
registry: ghcr.io
49+
username: ${{ github.actor }}
50+
password: ${{ secrets.ORG_PAT }}
51+
52+
- name: Build
53+
shell: bash
54+
run: wkg wit build -o "${{ github.event.repository.name }}-0.3.0.wasm" --wit-dir wit-0.3.0-draft
55+
56+
# Upload the Wasm binary to the GitHub registry
57+
- name: Publish to GitHub Container Registry
58+
id: publish
59+
uses: bytecodealliance/wkg-github-action@v5
60+
with:
61+
oci-reference-without-tag: "ghcr.io/webassembly/wasi/clocks-0.3.0"
62+
file: "${{ github.event.repository.name }}-0.3.0.wasm"
63+
description: "A WASI API for reading the current time and measuring elapsed time (0.3.0 version)."
64+
source: 'https://github.com/webassembly/wasi'
65+
homepage: 'https://wasi.dev'
66+
version: ${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.version'] }}
67+
licenses: 'Apache-2.0 WITH LLVM-exception'
68+
69+
# Sign the output component
70+
- name: Sign the wasm component
71+
run: cosign sign --yes ghcr.io/webassembly/wasi/clocks-0.3.0@${{ steps.publish.outputs.digest }}

.github/workflows/update-0.3.yml

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
name: Update 0.3.0 WIT Definitions
2+
3+
# Manually dispatch this action from the Actions page
4+
on:
5+
workflow_dispatch:
6+
7+
permissions:
8+
pull-requests: write
9+
contents: write
10+
11+
jobs:
12+
update-versions:
13+
runs-on: ubuntu-latest
14+
steps:
15+
# Checkout the repo and install dependencies
16+
- name: Checkout repository
17+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
18+
19+
- name: Install cargo-binstall
20+
uses: cargo-bins/cargo-binstall@8aac5aa2bf0dfaa2863eccad9f43c68fe40e5ec8 # v1.14.1
21+
22+
# TODO: we don't pin the versions here. It's not great but this will simplify our iteration
23+
# while we rapidly iterate on these tools. Pin when we're stable.
24+
- name: Install wit-bindgen
25+
shell: bash
26+
run: cargo binstall wit-bindgen-cli
27+
28+
- name: Install wit-deps
29+
shell: bash
30+
run: cargo binstall wit-deps-cli
31+
32+
- name: Set version with RC timestamp
33+
id: version
34+
run: |
35+
DATE=$(date +'%Y-%m-%d')
36+
BASE_VERSION="0.3.0-rc-${DATE}"
37+
COUNTER=1
38+
VERSION="${BASE_VERSION}"
39+
40+
# Check if the tag already exists
41+
while git ls-remote --tags origin | grep -q "refs/tags/v${VERSION}$"; do
42+
VERSION="${BASE_VERSION}-${COUNTER}"
43+
COUNTER=$((COUNTER + 1))
44+
done
45+
46+
echo "value=${VERSION}" >> $GITHUB_OUTPUT
47+
echo "Version will be: ${VERSION}"
48+
49+
# Update version in WIT definitions
50+
- name: Update version in WIT files
51+
run: |
52+
find wit-0.3.0-draft -name "*.wit" -exec sed -i "s/\(@since(version = \)[0-9]\+\.[0-9]\+\.[0-9]\+\(-rc-[0-9]\{4\}-[0-9]\{2\}-[0-9]\{2\}\(-[0-9]\+\)\?\)\?\()\)/\1${{ steps.version.outputs.value }}\4/g" {} +
53+
find wit-0.3.0-draft -name "*.wit" -exec sed -i "s/\(package wasi:[a-zA-Z0-9_-]\+@\)[0-9]\+\.[0-9]\+\.[0-9]\+\(-rc-[0-9]\{4\}-[0-9]\{2\}-[0-9]\{2\}\(-[0-9]\+\)\?\)\?/\1${{ steps.version.outputs.value }}/g" {} +
54+
55+
- name: Update wit deps
56+
run: |
57+
cd wit-0.3.0-draft
58+
wit-deps update || true # Continue even if no deps to update
59+
60+
# Create PR with changes using create-pull-request action
61+
- name: Create Pull Request
62+
uses: peter-evans/create-pull-request@c5a7806660adbe173f04e3e038b0ccdcd758773c # v6.1.0
63+
with:
64+
token: ${{ secrets.GITHUB_TOKEN }}
65+
commit-message: "Update 0.3.0 WIT definitions to ${{ steps.version.outputs.value }}"
66+
committer: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
67+
author: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
68+
branch: update-wit-${{ steps.version.outputs.value }}
69+
title: "Update 0.3.0 WIT definitions to ${{ steps.version.outputs.value }}"
70+
body: |
71+
Updates the 0.3.0 WIT definitions with version ${{ steps.version.outputs.value }}.
72+
73+
This is an automated update to rev the RC timestamp.
74+
75+
## Changes
76+
- Updated package and since version in WIT files
77+
- Updated WIT dependencies if applicable
78+
draft: false
79+
delete-branch: true

0 commit comments

Comments
 (0)