Skip to content

Commit 09235a7

Browse files
committed
ci: publish 0.3. workflows
1 parent 7b823e1 commit 09235a7

File tree

5 files changed

+160
-8
lines changed

5 files changed

+160
-8
lines changed

.github/workflows/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010
name: Check ABI files are up-to-date
1111
runs-on: ubuntu-latest
1212
steps:
13-
- uses: actions/checkout@v4
13+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
1414
- name: ensure `./wit/deps` are in sync
1515
run: |
1616
curl -Lo 'wit-deps' https://github.com/bytecodealliance/wit-deps/releases/download/v0.5.0/wit-deps-x86_64-unknown-linux-musl

.github/workflows/publish-0.3.yml

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

.github/workflows/publish.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ name: Publish a Wasm Component package to GitHub Artifacts
44
on:
55
push:
66
tags:
7-
- v*
7+
- v0.2.*
88
workflow_dispatch:
99

1010
env:
@@ -23,12 +23,12 @@ jobs:
2323
- name: Checkout repository
2424
uses: actions/checkout@v2
2525
- name: Install cargo-binstall
26-
uses: cargo-bins/cargo-binstall@v1.10.15
26+
uses: cargo-bins/cargo-binstall@8aac5aa2bf0dfaa2863eccad9f43c68fe40e5ec8 # v1.14.1
2727
- name: Install wkg
2828
shell: bash
2929
run: cargo binstall wkg
3030
- name: Install cosign
31-
uses: sigstore/cosign-installer@v3.7.0
31+
uses: sigstore/cosign-installer@d58896d6a1865668819e1d91763c7751a165e159 # v3.9.2
3232

3333
# To version our image we want to obtain the version from the tag
3434
- name: Get version
@@ -41,7 +41,7 @@ jobs:
4141
4242
# To upload our image to the GitHub registry, we first have to login
4343
- name: Login to the GitHub registry
44-
uses: docker/login-action@v3
44+
uses: docker/login-action@74a5d142397b4f367a81961eba4e8cd7edddf772 # v3.4.0
4545
with:
4646
registry: ghcr.io
4747
username: ${{ github.actor }}

.github/workflows/update-0.3.yml

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
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+
# Update @since version annotations
53+
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" {} +
54+
# Update all wasi package references (package, use, import, export, from)
55+
find wit-0.3.0-draft -name "*.wit" -exec sed -i "s/\( 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" {} +
56+
57+
- name: Update wit deps
58+
run: |
59+
wit-deps -m wit-0.3.0-draft/deps.toml -l wit-0.3.0-draft/deps.lock -d wit-0.3.0-draft/deps update
60+
61+
# Create PR with changes using create-pull-request action
62+
- name: Create Pull Request
63+
uses: peter-evans/create-pull-request@c5a7806660adbe173f04e3e038b0ccdcd758773c # v6.1.0
64+
with:
65+
token: ${{ secrets.GITHUB_TOKEN }}
66+
commit-message: "Update 0.3.0 WIT definitions to ${{ steps.version.outputs.value }}"
67+
committer: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
68+
author: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
69+
branch: update-wit-${{ steps.version.outputs.value }}
70+
title: "Update 0.3.0 WIT definitions to ${{ steps.version.outputs.value }}"
71+
body: |
72+
Updates the 0.3.0 WIT definitions with version ${{ steps.version.outputs.value }}.
73+
74+
This is an automated update to rev the RC timestamp.
75+
76+
## Changes
77+
- Updated package and since version in WIT files
78+
- Updated WIT dependencies if applicable
79+
draft: false
80+
delete-branch: true

.github/workflows/update.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@ jobs:
2323
steps:
2424
# Checkout the repo and install dependencies
2525
- name: Checkout repository
26-
uses: actions/checkout@v4
26+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
2727
- name: Install cargo-binstall
28-
uses: cargo-bins/cargo-binstall@v1.10.15
28+
uses: cargo-bins/cargo-binstall@8aac5aa2bf0dfaa2863eccad9f43c68fe40e5ec8 # v1.14.1
2929
- name: Install wit-bindgen
3030
shell: bash
3131
run: cargo binstall wit-bindgen-cli
@@ -41,7 +41,7 @@ jobs:
4141
- name: Upgrade tag
4242
run: find . -type f -name "*.wit" -exec sed -i "s/${{ inputs.prev_version }}/${{ inputs.next_version }}/g" {} +
4343
- name: Upgrade deps tags
44-
run: find . -type f -name "deps.toml" -exec sed -i "s/${{ inputs.prev_version }}/${{ inputs.next_version }}/g" {} +
44+
run: find . -type f -name "deps.toml" -exec sed -i "s/${{ inputs.prev_version }}/${{ inputs.next_version }}/g" {} +
4545
- name: Upgrade wit deps
4646
run: wit-deps update
4747
- name: Generate markdown for the proxy world

0 commit comments

Comments
 (0)