From 0b22eb59871cbec59aad2e3b18377c730eb0570b Mon Sep 17 00:00:00 2001 From: Yosh Date: Thu, 23 Jan 2025 18:24:19 +0100 Subject: [PATCH 1/2] update publish action --- .github/workflows/publish.yml | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index a545aab..3dfb6a0 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -1,4 +1,4 @@ -name: Publish a Wasm Component to GitHub Artifacts +name: Build and publish a Wasm Component to GitHub Artifacts on: push: @@ -9,6 +9,7 @@ on: env: IMAGE_NAME: ${{ github.repository }} COMPONENT_NAME: rust-wasi-hello + CARGO_COMPONENT_VERSION: "0.16.0" jobs: publish: @@ -21,6 +22,7 @@ jobs: steps: - name: Checkout repository uses: actions/checkout@v2 + - name: Docker meta id: meta uses: docker/metadata-action@v5 @@ -28,6 +30,7 @@ jobs: images: ghcr.io/${{ github.actor }}/{{ env.COMPONENT_NAME }} tags: | type=semver,pattern={{version}} + - name: Login to GitHub Container Registry uses: docker/login-action@v3 with: @@ -52,12 +55,14 @@ jobs: ${{ runner.os }}- - if: ${{ steps.cache-cargo.outputs.cache-hit != 'true' }} - name: Run install script + name: Install build dependencies continue-on-error: false - run: bash scripts/install.sh + run: | + cargo install cargo-component --force --version {{ env.CARGO_COMPONENT_VERSION }} + cargo install wkg --force - - name: Run build script - run: bash scripts/build.sh + - name: Build the component + run: cargo component build --release - name: Publish to GitHub Container Registry id: publish From 1d0ced6188bc7caaa976fb50ac86dc199603117f Mon Sep 17 00:00:00 2001 From: Yosh Date: Thu, 23 Jan 2025 18:25:22 +0100 Subject: [PATCH 2/2] remove scripts dir --- scripts/build.sh | 4 ---- scripts/install.sh | 7 ------- scripts/publish.sh | 16 ---------------- 3 files changed, 27 deletions(-) delete mode 100755 scripts/build.sh delete mode 100755 scripts/install.sh delete mode 100644 scripts/publish.sh diff --git a/scripts/build.sh b/scripts/build.sh deleted file mode 100755 index 66beb42..0000000 --- a/scripts/build.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/bash - -# build our project -cargo component build --release diff --git a/scripts/install.sh b/scripts/install.sh deleted file mode 100755 index ab858e9..0000000 --- a/scripts/install.sh +++ /dev/null @@ -1,7 +0,0 @@ -curl https://wasmtime.dev/install.sh -sSf | bash - -# install cargo-component -cargo install cargo-component --force --version 0.16.0 - -# install wkg -cargo install wkg --force diff --git a/scripts/publish.sh b/scripts/publish.sh deleted file mode 100644 index 338f6de..0000000 --- a/scripts/publish.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/bash -tags="$1" -# not running in github actions? use gh cli to login, etc, locally -if [ "$GITHUB_ACTIONS" != "true" ]; then - # login to the registry - # if running locally, we may need to: - # gh auth refresh -h github.com -s write:packages,read:packages - gh auth token | docker login ghcr.io --username YOURUSERNAME --password-stdin - GH_USER=$(gh api user --jq '.login') - IMAGE_NAME="${GH_USER}/rust-wasi-hello" -fi - -PROJECT_NAME="rust_wasi_hello" -REGISTRY_REFERENCE="ghcr.io/${IMAGE_NAME}:${tags}" - -wkg oci push $REGISTRY_REFERENCE target/wasm32-wasip1/release/$PROJECT_NAME.wasm