Skip to content

Commit

Permalink
Fixed the release pipeline
Browse files Browse the repository at this point in the history
Signed-off-by: jiaxiao zhou <[email protected]>
  • Loading branch information
Mossaka committed Sep 3, 2023
1 parent a7800ce commit 6519df3
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 38 deletions.
71 changes: 51 additions & 20 deletions .github/workflows/docker-build-push.yaml
Original file line number Diff line number Diff line change
@@ -1,29 +1,60 @@
name: 'Build and push Docker images'
on:
workflow_call:
inputs:
images:
required: true
type: string
platforms:
required: true
type: string
secrets:
envPAT:
required: true

jobs:
build_and_push:
permissions:
contents: write
packages: write
runs-on: ubuntu-latest
strategy:
matrix:
image: ${{fromJson(github.event.inputs.images)}}
image:
- imageName: examples/spin-rust-hello
context: images/spin
- imageName: examples/spin-dotnet-hello
context: images/spin_dotnet
- imageName: examples/slight-rust-hello
context: images/slight
- imageName: examples/wws-js-hello
context: images/wws
- imageName: examples/spin-inbound-redis
context: images/spin-inbound-redis
- imageName: examples/spin-outbound-redis
context: images/spin-outbound-redis
- imageName: examples/lunatic-rust-hello
context: images/lunatic
- imageName: examples/lunatic-spawn-process
context: images/lunatic-spawn-process
- imageName: examples/lunatic-submillisecond
context: images/lunatic-submillisecond
steps:
- name: build and push
uses: docker/build-push-action@v3
with:
push: true
tags: |
ghcr.io/deislabs/containerd-wasm-shims/${{ matrix.image.imageName }}:${{ env.RELEASE_VERSION }}
ghcr.io/deislabs/containerd-wasm-shims/${{ matrix.image.imageName }}:latest
context: ${{ matrix.image.context }}
platforms: ${{ github.event.inputs.platforms }}
- uses: actions/checkout@v3
- name: Set RELEASE_VERSION ENV var
run: echo "RELEASE_VERSION=${GITHUB_REF:10}" >> $GITHUB_ENV
- name: lowercase the runner OS name
shell: bash
run: |
OS=$(echo "${{ runner.os }}" | tr '[:upper:]' '[:lower:]')
echo "RUNNER_OS=$OS" >> $GITHUB_ENV
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: setup buildx
uses: docker/setup-buildx-action@v2
- name: login to GitHub container registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: build and push
uses: docker/build-push-action@v3
with:
push: true
tags: |
ghcr.io/deislabs/containerd-wasm-shims/${{ matrix.image.imageName }}:${{ env.RELEASE_VERSION }}
ghcr.io/deislabs/containerd-wasm-shims/${{ matrix.image.imageName }}:latest
context: ${{ matrix.image.context }}
platforms: wasi/wasm

28 changes: 10 additions & 18 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,14 @@ name: release
on:
push:
tags:
- 'v[0-9]+.[0-9]+.*'
- "v[0-9]+.[0-9]+.*"
jobs:
build:
uses: ./.github/workflows/build.yaml

build-and-push-wasm-images:
uses: ./.github/workflows/docker-build-push.yaml

release:
permissions:
contents: write
Expand All @@ -14,7 +18,7 @@ jobs:
if: startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Set RELEASE_VERSION ENV var
run: echo "RELEASE_VERSION=${GITHUB_REF:10}" >> $GITHUB_ENV
- name: lowercase the runner OS name
Expand All @@ -32,7 +36,7 @@ jobs:
path: _artifacts
- name: create release
env:
GH_TOKEN: ${{ secrets.envPAT }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release create ${{ env.RELEASE_VERSION }} \
--generate-notes \
Expand All @@ -52,21 +56,9 @@ jobs:
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.envPAT }}
- name: Build and push images
uses: ./.github/workflows/build_and_push.yaml
with:
images: |
[{"imageName": "examples/spin-rust-hello", "context": "images/spin"},
{"imageName": "examples/spin-dotnet-hello", "context": "images/spin_dotnet"},
{"imageName": "examples/slight-rust-hello", "context": "images/slight"},
{"imageName": "examples/wws-js-hello", "context": "images/wws"},
{"imageName": "examples/spin-inbound-redis", "context": "images/spin-inbound-redis"},
{"imageName": "examples/spin-outbound-redis", "context": "images/spin-outbound-redis"}],
{"imageName": "examples/lunatic-rust-hello", "context": "images/lunatic"}],
{"imageName": "examples/lunatic-spawn-process", "context": "images/lunatic-spawn-process"}],
{"imageName": "examples/lunatic-submillisecond", "context": "images/lunatic-submillisecond"}]
platforms: wasi/wasm
password: ${{ secrets.GITHUB_TOKEN }}

# Build and push k3d shim image
- name: untar x86_64 musl artifacts into ./deployments/k3d/.tmp dir
run: |
mkdir -p ./deployments/k3d/.tmp
Expand Down

0 comments on commit 6519df3

Please sign in to comment.