-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathaction.yml
100 lines (90 loc) · 3.37 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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
name: 'Verify WASI ABI files are up-to-date'
description: 'Verify WASI ABI files are up-to-date'
inputs:
wasm-tools:
description: 'version of `wasm-tools` to use'
required: false
default: '1.215.0'
wit-bindgen:
description: 'version of the `wit-bindgen` tool to use'
required: false
default: '0.30.0'
worlds:
description: 'worlds to generate documentation for'
required: false
default: '*'
directory:
description: 'the directory containing the WIT files'
default: 'wit'
features:
description: 'comma-separated list of features to enable'
required: false
default: ''
all-features:
description: 'whether or not to activate all features when processing WIT files'
required: false
default: "false"
runs:
using: composite
steps:
- name: Setup `wit-bindgen`
uses: bytecodealliance/actions/wit-bindgen/setup@v1.1.0
with:
version: ${{ inputs.wit-bindgen }}
- name: Setup `wasm-tools`
uses: bytecodealliance/actions/wasm-tools/setup@v1.1.0
with:
version: ${{ inputs.wasm-tools }}
- name: Generate documentation for each world
shell: bash
if: ${{ inputs.worlds == '*' }}
run: |
all_features_flag=""
if [ "${{ inputs.all-features }}" == "true" ]; then
all_features_flag="--all-features"
fi
wit-bindgen markdown ${{ inputs.directory }} --features=${{inputs.features}} $all_features_flag --check --html-in-md
env:
WIT_REQUIRE_SEMICOLONS: 1
- name: Generate documentation for each world
shell: bash
if: ${{ inputs.worlds != '*' }}
run: |
set -ex
all_features_flag=""
if [ "${{ inputs.all-features }}" == "true" ]; then
all_features_flag="--all-features"
fi
for world in ${{ inputs.worlds }}; do
wit-bindgen markdown ${{ inputs.directory }} -w $world --features=${{ inputs.features }} $all_features_flag --check --html-in-md
done
- name: Print generation instructions
if: ${{ failure() }}
shell: bash
run: |
echo 'Failed to verity that `*.md` files are up-to-date with'
echo 'their `${{ inputs.directory }}/*.wit` counterparts. The `wit-bindgen` tool needs to'
echo 'be rerun on this branch and the changes should be committed'
echo ''
echo ' cargo install wit-bindgen-cli@${{ inputs.wit-bindgen }}'
echo ' wit-bindgen markdown ${{ inputs.directory }} --features=${{inputs.features}} --html-in-md'
echo ''
echo 'That command will regenerate the `*.md` files to get committed here'
- name: Determine package name
shell: bash
id: package
run: |
package=$(wasm-tools component wit ${{ inputs.directory }} | grep package | head -n 1)
package=$(echo $package | sed 's/package //' | sed 's/;//' | sed 's/:/-/')
echo "package=$package" >> "$GITHUB_OUTPUT"
- name: Generate wasm-encoded WIT package
shell: bash
run: wasm-tools component wit ${{ inputs.directory }} --wasm -o ${{ steps.package.outputs.package }}.wasm
- uses: actions/upload-artifact@v4
with:
path: ${{ steps.package.outputs.package }}.wasm
- name: Release tagged build
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags')
with:
files: ${{ steps.package.outputs.package }}.wasm