Skip to content

Commit 2f62e9b

Browse files
committed
Use IMAGE_NAME via action vs gh api user locally
Signed-off-by: Aaron Wislang <aaron.wislang@microsoft.com>
1 parent 03575a7 commit 2f62e9b

2 files changed

Lines changed: 11 additions & 2 deletions

File tree

.github/workflows/publish.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ on:
99
- main
1010
workflow_dispatch:
1111

12+
env:
13+
IMAGE_NAME: ${{ github.repository }}
14+
1215
jobs:
1316
publish:
1417
runs-on: ubuntu-latest

scripts/publish.sh

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,13 @@ gh auth token | docker login ghcr.io --username YOURUSERNAME --password-stdin
77

88
# publish using wkg
99
PROJECT_NAME="rust_wasi_hello"
10-
GH_USER=$(gh api user --jq '.login')
11-
REGISTRY_REFERENCE="ghcr.io/${GH_USER}/rust-wasi-hello:latest"
10+
11+
if [ -z "$IMAGE_NAME" ]; then
12+
GH_USER=$(gh api user --jq '.login')
13+
IMAGE_NAME="${GH_USER}/rust-wasi-hello"
14+
export IMAGE_NAME
15+
fi
16+
17+
REGISTRY_REFERENCE="ghcr.io/${IMAGE_NAME}:latest"
1218

1319
wkg oci push $REGISTRY_REFERENCE target/wasm32-wasip1/release/$PROJECT_NAME.wasm

0 commit comments

Comments
 (0)