File tree Expand file tree Collapse file tree 4 files changed +51
-16
lines changed Expand file tree Collapse file tree 4 files changed +51
-16
lines changed Original file line number Diff line number Diff line change 99 - main
1010 workflow_dispatch :
1111
12+ env :
13+ IMAGE_NAME : ${{ github.repository }}
14+
1215jobs :
1316 publish :
1417 runs-on : ubuntu-latest
1720 - name : Checkout repository
1821 uses : actions/checkout@v2
1922
23+ - name : Login to GitHub Container Registry
24+ uses : docker/login-action@v3
25+ with :
26+ registry : ghcr.io
27+ username : ${{ github.actor }}
28+ password : ${{ secrets.GITHUB_TOKEN }}
29+
30+ - name : Cache cargo bin
31+ id : cache-cargo
32+ uses : actions/cache@v3
33+ env :
34+ cache-name : cache-cargo-bin
35+ with :
36+ path : ~/.cargo/bin
37+ key : ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('scripts/install.sh') }}
38+ restore-keys : |
39+ ${{ runner.os }}-build-${{ env.cache-name }}-
40+ ${{ runner.os }}-build-
41+ ${{ runner.os }}-
42+
43+ - if : ${{ steps.cache-cargo.outputs.cache-hit != 'true' }}
44+ name : Run install script
45+ continue-on-error : false
46+ run : bash scripts/install.sh
47+
2048 - name : Run build script
2149 run : bash scripts/build.sh
2250
Original file line number Diff line number Diff line change 11#! /bin/bash
22
3- # install cargo-component
4- cargo install cargo-component
5-
63# build our project
74cargo component build --release
Original file line number Diff line number Diff line change 1+ # setup dir
2+ mkdir -p tmp
3+ cd tmp
4+
5+ # install wkg
6+ git clone https://github.com/bytecodealliance/wasm-pkg-tools
7+ cd wasm-pkg-tools/crates/wkg
8+ cargo install --path .
9+ cd ../../../../
10+
11+ # install cargo-component
12+ cargo install cargo-component --force --version 0.16.0
Original file line number Diff line number Diff line change 11#! /bin/bash
22
3- # setup dir
4- mkdir -p tmp
5- cd tmp
3+ # not running in github actions? use gh cli to login, etc, locally
4+ if [ " $GITHUB_ACTIONS " != " true" ]; then
5+ # login to the registry
6+ # if running locally, we may need to:
7+ # gh auth refresh -h github.com -s write:packages,read:packages
8+ gh auth token | docker login ghcr.io --username YOURUSERNAME --password-stdin
9+ GH_USER=$( gh api user --jq ' .login' )
10+ IMAGE_NAME=" ${GH_USER} /rust-wasi-hello"
11+ fi
612
7- # install wkg
8- git clone https://github.com/bytecodealliance/wasm-pkg-tools
9- cd wasm-pkg-tools
10- cargo install --path .
11-
12- # login to the registry
13- gh auth token | docker login ghcr.io --username yoshuawuyts --password-stdin
14-
15- # publish using wkg
1613PROJECT_NAME=" rust_wasi_hello"
17- REGISTRY_REFERENCE=" ghcr.io/yoshuawuyts/rust-wasi-hello:latest"
14+ REGISTRY_REFERENCE=" ghcr.io/${IMAGE_NAME} :latest"
15+
1816wkg oci push $REGISTRY_REFERENCE target/wasm32-wasip1/release/$PROJECT_NAME .wasm
You can’t perform that action at this time.
0 commit comments