This repository was archived by the owner on Nov 25, 2025. It is now read-only.
generated from WebAssembly/wasi-proposal-template
-
Notifications
You must be signed in to change notification settings - Fork 21
Automate publishing and signing of Wasm Components #56
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,70 @@ | ||
| name: Publish a Wasm Component package to GitHub Artifacts | ||
|
|
||
| # Run this action whenever a new release is tagged | ||
| on: | ||
| push: | ||
| tags: | ||
| - v* | ||
| workflow_dispatch: | ||
|
|
||
| env: | ||
| IMAGE_NAME: ${{ github.repository }} | ||
|
|
||
| jobs: | ||
| publish: | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| id-token: write | ||
| packages: write | ||
| contents: read | ||
|
|
||
| steps: | ||
| # Checkout the repo and install dependencies | ||
| - name: Checkout repository | ||
| uses: actions/checkout@v2 | ||
| - name: Install cargo-binstall | ||
| uses: cargo-bins/cargo-binstall@v1.10.15 | ||
| - name: Install wkg | ||
| shell: bash | ||
| run: cargo binstall wkg | ||
| - name: Install cosign | ||
| uses: sigstore/cosign-installer@v3.7.0 | ||
|
|
||
| # To version our image we want to obtain the version from the tag | ||
| - name: Get version | ||
| id: meta | ||
| uses: docker/metadata-action@v5 | ||
| with: | ||
| images: ghcr.io/webassembly/wasi/cli | ||
| tags: | | ||
| type=semver,pattern={{version}} | ||
|
|
||
| # To upload our image to the GitHub registry, we first have to login | ||
| - name: Login to the GitHub registry | ||
| uses: docker/login-action@v3 | ||
| with: | ||
| registry: ghcr.io | ||
| username: ${{ github.actor }} | ||
| password: ${{ secrets.GITHUB_TOKEN }} | ||
|
|
||
| # Build our `.wit` files into a Wasm binary | ||
| - name: Build | ||
| shell: bash | ||
| run: wkg wit build -o wasi-cli.wasm | ||
|
|
||
| # Upload the Wasm binary to the GitHub registry | ||
| - name: Publish to GitHub Container Registry | ||
| id: publish | ||
| uses: bytecodealliance/wkg-github-action@v5 | ||
| with: | ||
| oci-reference-without-tag: 'ghcr.io/webassembly/wasi/cli' | ||
| file: 'wasi-cli.wasm' | ||
| description: 'A WASI API for Command-Line Interface environments.' | ||
| source: 'https://github.com/webassembly/wasi' | ||
| homepage: 'https://wasi.dev' | ||
| version: ${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.version'] }} | ||
| licenses: 'Apache-2.0 WITH LLVM-exception' | ||
|
|
||
| # Sign the output component | ||
| - name: Sign the wasm component | ||
| run: cosign sign --yes ghcr.io/webassembly/wasi/cli@${{ steps.publish.outputs.digest }} | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We'll want to pin wkg version eventually but let's not block on that