Update publish.yml (#94) #7
Workflow file for this run
This file contains 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
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 | |
steps: | |
# Checkout the repo and install dependencies | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Install cargo-binstall | |
uses: cargo-bins/[email protected] | |
- name: Install wkg | |
shell: bash | |
run: cargo binstall wkg | |
# 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/io | |
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-io.wasm | |
# Upload the Wasm binary to the GitHub registry | |
- uses: bytecodealliance/wkg-github-action@v3 | |
with: | |
oci-reference-without-tag: 'ghcr.io/webassembly/wasi/io' | |
file: 'wasi-io.wasm' | |
description: 'A WASI API providing I/O stream abstractions.' | |
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' |