chore(release) many fixes & improvements #393
Workflow file for this run
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: | |
schedule: | |
- cron: "0 6 * * mon" # 6am UTC, 11pm PST | |
pull_request: | |
branches: '**' | |
workflow_dispatch: | |
inputs: | |
release_name: | |
type: string | |
description: "Release name (e.g. 0.1.0)" | |
required: true | |
create_release: | |
type: boolean | |
description: "Create release?" | |
required: true | |
default: false | |
prerelease: | |
type: boolean | |
description: "Prerelease?" | |
required: true | |
default: true | |
defaults: | |
run: | |
shell: bash | |
env: | |
CC: clang | |
RETENTION_DAYS: 7 | |
jobs: | |
setup: | |
name: "Setup release & runtime versions" | |
runs-on: ubuntu-latest | |
outputs: | |
wasmtime_ver: ${{ steps.assign-versions.outputs.wasmtime_ver }} | |
wasmer_ver: ${{ steps.assign-versions.outputs.wasmer_ver }} | |
v8_ver: ${{ steps.assign-versions.outputs.v8_ver }} | |
create_release: ${{ steps.assign-vars.outputs.create_release }} | |
release_name: ${{ steps.assign-vars.outputs.release_name }} | |
release_channel: ${{ steps.assign-vars.outputs.release_channel }} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Assign runtime versions | |
id: assign-versions | |
run: | | |
export NGX_WASM_DIR=$(pwd) | |
. ./util/_lib.sh | |
echo "wasmtime_ver=$(get_variable_from_makefile WASMTIME)" >> $GITHUB_OUTPUT | |
echo "wasmer_ver=$(get_variable_from_makefile WASMER)" >> $GITHUB_OUTPUT | |
echo "v8_ver=$(get_variable_from_makefile V8)" >> $GITHUB_OUTPUT | |
- id: assign-vars | |
name: Assign release variables | |
run: | | |
if [ "${{ github.event_name }}" = schedule ]; then | |
# nightly | |
echo "create_release=true" >> $GITHUB_OUTPUT | |
echo "release_name=nightly-$(date -u +%Y%m%d)" >> $GITHUB_OUTPUT | |
echo "release_channel=nightly" >> $GITHUB_OUTPUT | |
elif [ -n "${{ github.event.inputs.release_name }}" ]; then | |
# release/prerelease | |
echo "create_release=${{ github.event.inputs.create_release == 'true' }}" >> $GITHUB_OUTPUT | |
echo "release_name=${{ github.event.inputs.release_name }}" >> $GITHUB_OUTPUT | |
echo "release_channel=${{ github.event.inputs.prerelease == 'true' && 'prerelease' || 'release' }}" >> $GITHUB_OUTPUT | |
else | |
# GHA test run | |
echo "create_release=false" >> $GITHUB_OUTPUT | |
echo "release_name=gha-run-${{ github.run_number }}" >> $GITHUB_OUTPUT | |
fi | |
source-release: | |
name: "Source release" | |
needs: setup | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Build archive | |
run: ./util/release.sh ${{ needs.setup.outputs.release_name }} --src | |
- name: Upload archive | |
uses: actions/upload-artifact@v2 | |
with: | |
name: release-artifacts | |
path: dist | |
retention-days: ${{ env.RETENTION_DAYS }} | |
build-images: | |
name: "Build compilation images" | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
include: | |
- name: "Ubuntu 18.04 build image" | |
file: "./assets/release/Dockerfiles/Dockerfile.amd64.ubuntu-18.04" | |
tags: "ghcr.io/kong/wasmx-build-ubuntu:18.04" | |
- name: "Ubuntu 20.04 build image" | |
file: "./assets/release/Dockerfiles/Dockerfile.ubuntu-20.04" | |
tags: "ghcr.io/kong/wasmx-build-ubuntu:20.04" | |
- name: "Ubuntu 22.04 build image" | |
file: "./assets/release/Dockerfiles/Dockerfile.ubuntu-22.04" | |
tags: "ghcr.io/kong/wasmx-build-ubuntu:22.04" | |
- name: "Centos 7 build image" | |
file: "./assets/release/Dockerfiles/Dockerfile.amd64.centos7" | |
tags: "ghcr.io/kong/wasmx-build-centos:7" | |
- name: "Centos 8 build image" | |
file: "./assets/release/Dockerfiles/Dockerfile.amd64.centos8" | |
tags: "ghcr.io/kong/wasmx-build-centos:8" | |
- name: "ArchLinux build image" | |
file: "./assets/release/Dockerfiles/Dockerfile.amd64.archlinux" | |
tags: "ghcr.io/kong/wasmx-build-arch:latest" | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v1 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.TOKEN_GITHUB }} | |
- name: Setup QEMU | |
uses: docker/setup-qemu-action@v1 | |
- name: Setup Docker Buildx | |
uses: docker/setup-buildx-action@v1 | |
- name: ${{ matrix.name }} | |
uses: docker/build-push-action@v2 | |
with: | |
file: ${{ matrix.file }} | |
tags: ${{ matrix.tags }} | |
push: true | |
binary-ubuntu-bionic: | |
name: "Build Ubuntu 18.04 (bionic) binary" | |
needs: [setup, build-images] | |
runs-on: ubuntu-latest | |
env: | |
WASMTIME_VER: ${{ needs.setup.outputs.wasmtime_ver }} | |
WASMER_VER: ${{ needs.setup.outputs.wasmer_ver }} | |
V8_VER: ${{ needs.setup.outputs.v8_ver }} | |
container: | |
image: ghcr.io/kong/wasmx-build-ubuntu:18.04 | |
credentials: | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.TOKEN_GITHUB }} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Build binary | |
run: ./util/release.sh ${{ needs.setup.outputs.release_name }} --bin | |
env: | |
GITHUB_OAUTH_TOKEN: ${{ secrets.GH_BOT_TOKEN }} | |
- name: Upload binary | |
uses: actions/upload-artifact@v2 | |
with: | |
name: release-artifacts | |
path: dist | |
retention-days: ${{ env.RETENTION_DAYS }} | |
- uses: actions/upload-artifact@v2 | |
if: failure() | |
with: | |
name: ${{ github.workflow }}-${{ github.job }}-sha-${{ github.sha }}-run-${{ github.run_number }} | |
path: work/dist/build/* | |
binary-ubuntu-focal: | |
name: "Build Ubuntu 20.04 (focal) binary" | |
needs: [setup, build-images] | |
runs-on: ubuntu-latest | |
env: | |
WASMTIME_VER: ${{ needs.setup.outputs.wasmtime_ver }} | |
WASMER_VER: ${{ needs.setup.outputs.wasmer_ver }} | |
V8_VER: ${{ needs.setup.outputs.v8_ver }} | |
container: | |
image: ghcr.io/kong/wasmx-build-ubuntu:20.04 | |
credentials: | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.TOKEN_GITHUB }} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Build binary | |
run: ./util/release.sh ${{ needs.setup.outputs.release_name }} --bin | |
env: | |
GITHUB_OAUTH_TOKEN: ${{ secrets.GH_BOT_TOKEN }} | |
- name: Upload binary | |
uses: actions/upload-artifact@v2 | |
with: | |
name: release-artifacts | |
path: dist | |
retention-days: ${{ env.RETENTION_DAYS }} | |
- uses: actions/upload-artifact@v2 | |
if: failure() | |
with: | |
name: ${{ github.workflow }}-${{ github.job }}-sha-${{ github.sha }}-run-${{ github.run_number }} | |
path: work/dist/build/* | |
binary-ubuntu-jammy: | |
name: "Build Ubuntu 22.04 (jammy) binary" | |
needs: [setup, build-images] | |
runs-on: ubuntu-latest | |
env: | |
WASMTIME_VER: ${{ needs.setup.outputs.wasmtime_ver }} | |
WASMER_VER: ${{ needs.setup.outputs.wasmer_ver }} | |
V8_VER: ${{ needs.setup.outputs.v8_ver }} | |
container: | |
image: ghcr.io/kong/wasmx-build-ubuntu:22.04 | |
credentials: | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.TOKEN_GITHUB }} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Build binary | |
run: ./util/release.sh ${{ needs.setup.outputs.release_name }} --bin | |
env: | |
GITHUB_OAUTH_TOKEN: ${{ secrets.GH_BOT_TOKEN }} | |
- name: Upload binary | |
uses: actions/upload-artifact@v3 | |
with: | |
name: release-artifacts | |
path: dist | |
retention-days: ${{ env.RETENTION_DAYS }} | |
- uses: actions/upload-artifact@v3 | |
if: failure() | |
with: | |
name: ${{ github.workflow }}-${{ github.job }}-sha-${{ github.sha }}-run-${{ github.run_number }} | |
path: work/dist/build/* | |
binary-ubuntu-jammy-arm: | |
name: "Build ARM Ubuntu 22.04 (jammy) binary" | |
needs: [setup, build-images] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Setup QEMU | |
uses: docker/setup-qemu-action@v2 | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v1 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.TOKEN_GITHUB }} | |
- run: | | |
docker run \ | |
--platform=linux/arm64 \ | |
--volume $PWD:/wasmx \ | |
--volume $GITHUB_ENV:$GITHUB_ENV \ | |
-e CI \ | |
-e GITHUB_ENV \ | |
--env CARGO_NET_GIT_FETCH_WITH_CLI=true \ | |
--env WASMTIME_VER='${{ needs.setup.outputs.wasmtime_ver }}' \ | |
--env WASMER_VER='${{ needs.setup.outputs.wasmer_ver }}' \ | |
--env V8_VER='${{ needs.setup.outputs.v8_ver }}' \ | |
ghcr.io/kong/wasmx-build-ubuntu:22.04 \ | |
/wasmx/util/release.sh ${{ needs.setup.outputs.release_name }} --bin | |
- name: Upload binary | |
uses: actions/upload-artifact@v2 | |
with: | |
name: release-artifacts | |
path: dist | |
retention-days: ${{ env.RETENTION_DAYS }} | |
- uses: actions/upload-artifact@v2 | |
if: failure() | |
with: | |
name: ${{ github.workflow }}-${{ github.job }}-sha-${{ github.sha }}-run-${{ github.run_number }} | |
path: work/dist/build/* | |
binary-centos7: | |
name: "Build Centos 7 binary" | |
needs: [setup, build-images] | |
runs-on: ubuntu-latest | |
env: | |
WASMTIME_VER: ${{ needs.setup.outputs.wasmtime_ver }} | |
WASMER_VER: ${{ needs.setup.outputs.wasmer_ver }} | |
V8_VER: ${{ needs.setup.outputs.v8_ver }} | |
container: | |
image: ghcr.io/kong/wasmx-build-centos:7 | |
credentials: | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.TOKEN_GITHUB }} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Build binary | |
run: ./util/release.sh ${{ needs.setup.outputs.release_name }} --bin | |
env: | |
GITHUB_OAUTH_TOKEN: ${{ secrets.GH_BOT_TOKEN }} | |
- name: Upload binary | |
uses: actions/upload-artifact@v2 | |
with: | |
name: release-artifacts | |
path: dist | |
retention-days: ${{ env.RETENTION_DAYS }} | |
- uses: actions/upload-artifact@v2 | |
if: failure() | |
with: | |
name: ${{ github.workflow }}-${{ github.job }}-sha-${{ github.sha }}-run-${{ github.run_number }} | |
path: work/dist/build/* | |
binary-centos8: | |
name: "Build Centos 8 binary" | |
needs: [setup, build-images] | |
runs-on: ubuntu-latest | |
env: | |
WASMTIME_VER: ${{ needs.setup.outputs.wasmtime_ver }} | |
WASMER_VER: ${{ needs.setup.outputs.wasmer_ver }} | |
V8_VER: ${{ needs.setup.outputs.v8_ver }} | |
container: | |
image: ghcr.io/kong/wasmx-build-centos:8 | |
credentials: | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.TOKEN_GITHUB }} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Build binary | |
run: ./util/release.sh ${{ needs.setup.outputs.release_name }} --bin | |
env: | |
GITHUB_OAUTH_TOKEN: ${{ secrets.GH_BOT_TOKEN }} | |
- name: Upload binary | |
uses: actions/upload-artifact@v2 | |
with: | |
name: release-artifacts | |
path: dist | |
retention-days: ${{ env.RETENTION_DAYS }} | |
- uses: actions/upload-artifact@v2 | |
if: failure() | |
with: | |
name: ${{ github.workflow }}-${{ github.job }}-sha-${{ github.sha }}-run-${{ github.run_number }} | |
path: work/dist/build/* | |
binary-arch: | |
name: "Build ArchLinux binary" | |
needs: [setup, build-images] | |
runs-on: ubuntu-latest | |
env: | |
WASMTIME_VER: ${{ needs.setup.outputs.wasmtime_ver }} | |
WASMER_VER: ${{ needs.setup.outputs.wasmer_ver }} | |
V8_VER: ${{ needs.setup.outputs.v8_ver }} | |
container: | |
image: ghcr.io/kong/wasmx-build-arch:latest | |
credentials: | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.TOKEN_GITHUB }} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Build binary | |
run: ./util/release.sh ${{ needs.setup.outputs.release_name }} --bin | |
env: | |
GITHUB_OAUTH_TOKEN: ${{ secrets.GH_BOT_TOKEN }} | |
- name: Upload binary | |
uses: actions/upload-artifact@v2 | |
with: | |
name: release-artifacts | |
path: dist | |
retention-days: ${{ env.RETENTION_DAYS }} | |
- uses: actions/upload-artifact@v2 | |
if: failure() | |
with: | |
name: ${{ github.workflow }}-${{ github.job }}-sha-${{ github.sha }}-run-${{ github.run_number }} | |
path: work/dist/build/* | |
binary-macos: | |
name: "Build macOS binary" | |
needs: [setup, build-images] | |
runs-on: macos-latest | |
env: | |
WASMTIME_VER: ${{ needs.setup.outputs.wasmtime_ver }} | |
WASMER_VER: ${{ needs.setup.outputs.wasmer_ver }} | |
V8_VER: ${{ needs.setup.outputs.v8_ver }} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Setup Homebrew dependencies | |
run: brew install ninja openssh | |
- name: Build binary | |
run: ./util/release.sh ${{ needs.setup.outputs.release_name }} --bin | |
env: | |
GITHUB_OAUTH_TOKEN: ${{ secrets.GH_BOT_TOKEN }} | |
- name: Upload binary | |
uses: actions/upload-artifact@v2 | |
with: | |
name: release-artifacts | |
path: dist | |
retention-days: ${{ env.RETENTION_DAYS }} | |
- uses: actions/upload-artifact@v2 | |
if: failure() | |
with: | |
name: ${{ github.workflow }}-${{ github.job }}-sha-${{ github.sha }}-run-${{ github.run_number }} | |
path: work/dist/build/* | |
upload-artifacts: | |
name: "Upload release artifacts" | |
needs: [setup, source-release, binary-ubuntu-bionic, binary-ubuntu-focal, binary-ubuntu-jammy, binary-ubuntu-jammy-arm, binary-centos7, binary-centos8, binary-arch, binary-macos] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Retrieve sibling release artifacts | |
uses: actions/download-artifact@v2 | |
with: | |
name: release-artifacts | |
- name: Drop Wasmer binaries | |
run: find . -name '*wasmer*' | xargs rm -f | |
# Channel: nightly | |
- name: Nightly release | |
uses: marvinpinto/action-automatic-releases@latest | |
if: ${{ needs.setup.outputs.create_release == 'true' && needs.setup.outputs.release_channel == 'nightly' }} | |
with: | |
prerelease: true | |
title: ${{ needs.setup.outputs.release_name }} | |
automatic_release_tag: nightly | |
repo_token: ${{ secrets.GITHUB_TOKEN }} | |
files: | | |
*.tar.gz | |
# Channel: prerelease | |
- name: Prerelease | |
uses: marvinpinto/action-automatic-releases@latest | |
if: ${{ needs.setup.outputs.create_release == 'true' && needs.setup.outputs.release_channel == 'prerelease' }} | |
with: | |
draft: true | |
prerelease: true | |
title: Prerelease - ${{ needs.setup.outputs.release_name }} | |
automatic_release_tag: prerelease-${{ needs.setup.outputs.release_name }} | |
repo_token: ${{ secrets.GITHUB_TOKEN }} | |
files: | | |
*.tar.gz | |
# Channel: release | |
- name: Release | |
uses: marvinpinto/action-automatic-releases@latest | |
if: ${{ needs.setup.outputs.create_release == 'true' && needs.setup.outputs.release_channel == 'release' }} | |
with: | |
draft: true | |
prerelease: false | |
title: Release - ${{ needs.setup.outputs.release_name }} | |
automatic_release_tag: release-${{ needs.setup.outputs.release_name }} | |
repo_token: ${{ secrets.GITHUB_TOKEN }} | |
files: | | |
*.tar.gz |