Merge pull request #188 from spinkube/dependabot/cargo/patch-16bcfc523a #112
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: release | |
on: | |
push: | |
branches: | |
- main | |
tags: | |
- "v[0-9]+.[0-9]+.*" | |
jobs: | |
build: | |
uses: ./.github/workflows/build.yaml | |
build-and-push-wasm-images: | |
uses: ./.github/workflows/docker-build-push.yaml | |
with: | |
test: false | |
publish-node-installer-image: | |
uses: ./.github/workflows/node-installer.yaml | |
needs: build | |
with: | |
ref: ${{ github.ref }} | |
release: | |
permissions: | |
contents: write | |
packages: write | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set RELEASE_VERSION ENV var | |
run: | | |
if [[ "${{ startsWith(github.ref, 'refs/tags/v') }}" == "true" ]]; then | |
echo "RELEASE_VERSION=${{ github.ref_name }}" >> $GITHUB_ENV | |
else | |
echo "RELEASE_VERSION=$(date +%Y%m%d-%H%M%S)-g$(git rev-parse --short HEAD)" >> $GITHUB_ENV | |
fi | |
- uses: actions/download-artifact@v4 | |
with: | |
path: _artifacts | |
- name: copy release workload assets into _dist | |
if: startsWith(github.ref, 'refs/tags/v') | |
run: | | |
mkdir -p _dist | |
cp ./deployments/workloads/runtime.yaml _dist/runtime.yaml | |
cp ./deployments/workloads/workload.yaml _dist/workload.yaml | |
- name: create release | |
if: startsWith(github.ref, 'refs/tags/v') | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
gh release create ${{ env.RELEASE_VERSION }} \ | |
--generate-notes \ | |
-p \ | |
_dist/runtime.yaml#example-runtimes \ | |
_dist/workload.yaml#example-workloads \ | |
for f in ./_artifacts/*/*.tar.gz; do gh release upload ${{ env.RELEASE_VERSION }} $f; done | |
# Setup buildx to build multiarch image: https://github.com/docker/build-push-action/blob/master/docs/advanced/multi-platform.md | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: setup buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: login to GitHub container registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
# Build and push k3d shim image | |
- name: untar musl artifacts into ./deployments/k3d/.tmp/linux/(amd64|arm64) dir | |
run: | | |
mkdir -p ./deployments/k3d/.tmp/linux/amd64 | |
mkdir -p ./deployments/k3d/.tmp/linux/arm64 | |
for f in ./_artifacts/*/*-x86_64.tar.gz; do tar -xf $f --directory ./deployments/k3d/.tmp/linux/amd64; done | |
for f in ./_artifacts/*/*-aarch64.tar.gz; do tar -xf $f --directory ./deployments/k3d/.tmp/linux/arm64; done | |
- name: build and push k3d shim image | |
uses: docker/build-push-action@v5 | |
with: | |
push: true | |
tags: | | |
ghcr.io/${{ github.repository }}/k3d:${{ env.RELEASE_VERSION }} | |
context: deployments/k3d | |
platforms: linux/amd64,linux/arm64 | |
build-args: | | |
STAGE=release | |
- name: clear | |
if: always() | |
run: | | |
rm -f ${HOME}/.docker/config.json |