generated from bytecodealliance/ba-template
-
Notifications
You must be signed in to change notification settings - Fork 3
/
action.yml
80 lines (74 loc) · 2.78 KB
/
action.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
name: 'wkg'
description: 'Publish a Wasm package using `wkg`'
inputs:
# Dependency versions
wkg:
description: 'version of `wkg` to use'
required: false
# Parameters to wkg
file:
description: The path to the file to push
required: true
# TODO we don't like this but shortcut for quick first version
oci-reference-without-tag:
description: 'ghcr.io/webassembly/wasi/wasi-io'
required: true
# registry:
# description: 'OCI registry for the package, e.g. `ghcr.io`'
# required: false
# default: 'ghcr.io'
# namespace:
# description: 'Namespace for the package, e.g. `wasi`'
# required: false
# component:
# description: 'Component name for the package, e.g. `wasi-io`'
# required: true
description:
description: 'Value for org.opencontainers.image.description'
required: false
source:
description: 'Value for org.opencontainers.image.source'
required: false
homepage:
description: 'Value for org.opencontainers.image.homepage'
required: false
version:
description: 'Value for org.opencontainers.image.version without the `v` prefix'
required: true
licenses:
description: 'Value for org.opencontainers.image.licenses'
required: false
runs:
using: composite
steps:
# Install `cargo-binstall`
# steps inlined from: https://github.com/cargo-bins/cargo-binstall/blob/main/action.yml
- name: Install cargo-binstall
if: runner.os != 'Windows'
shell: sh
run: curl -L --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/cargo-bins/cargo-binstall/main/install-from-binstall-release.sh | bash
- name: Install cargo-binstall
if: runner.os == 'Windows'
run: Set-ExecutionPolicy Unrestricted -Scope Process; iex (iwr "https://raw.githubusercontent.com/cargo-bins/cargo-binstall/main/install-from-binstall-release.ps1").Content
shell: powershell
# Install action dependencies
- name: Setup `wkg`
shell: bash
run: |
set -ex
cargo binstall wkg
# Run the action
- name: Push the Wasm binary to the registry
shell: bash
if: ${{ inputs.worlds != '*' }}
run: |
set -ex
wkg oci push ${{ inputs.oci-reference-without-tag }}:${{ inputs.version }} ${{ inputs.file }}\
--annotation "org.opencontainers.image.description"="${{ inputs.description }}" \
--annotation "org.opencontainers.image.source"="${{ inputs.source }}" \
--annotation "org.opencontainers.image.url"="${{ inputs.homepage }}" \
--annotation "org.opencontainers.image.version"="${{ inputs.version }}" \
--annotation "org.opencontainers.image.licenses"="${{ inputs.licenses }}"
- uses: actions/upload-artifact@v4
with:
path: ${{ steps.package.outputs.package }}.wasm