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_version: | ||
type: string | ||
description: "Release version (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 | ||
timeout-minutes: ${{ fromJSON(vars.GHA_DEFAULT_TIMEOUT) }} | ||
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 }} | ||
release_version: ${{ steps.assign-vars.outputs.release_version }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- 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 | ||
# wasmx-nightly-20231201 | ||
channel="nightly" | ||
version="$(date -u +%Y%m%d)" | ||
echo "create_release=true" >> $GITHUB_OUTPUT | ||
echo "release_name=$channel-$version" >> $GITHUB_OUTPUT | ||
elif [ -n "${{ github.event.inputs.release_version }}" ]; then | ||
# release/prerelease | ||
version="${{ github.event.inputs.release_version }}" | ||
echo "create_release=${{ github.event.inputs.create_release == 'true' }}" >> $GITHUB_OUTPUT | ||
if [ "${{ github.event.inputs.prerelease }}" = "true" ]; then | ||
# wasmx-prerelease-0.2.0 | ||
channel="prerelease" | ||
echo "release_name=$channel-$version" >> $GITHUB_OUTPUT | ||
else | ||
# wasmx-1.0.0 | ||
channel="release" | ||
echo "release_name=$version" >> $GITHUB_OUTPUT | ||
fi | ||
else | ||
# GHA test run | ||
# wasmx-gha-run-1234 | ||
channel="gha-run" | ||
version="${{ github.run_number }}" | ||
echo "create_release=false" >> $GITHUB_OUTPUT | ||
echo "release_name=$channel-$version" >> $GITHUB_OUTPUT | ||
fi | ||
echo "release_channel=$channel" >> $GITHUB_OUTPUT | ||
echo "release_version=$version" >> $GITHUB_OUTPUT | ||
source-release: | ||
name: "Source release" | ||
needs: setup | ||
runs-on: ubuntu-latest | ||
timeout-minutes: ${{ fromJSON(vars.GHA_DEFAULT_TIMEOUT) }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Build archive | ||
run: ./util/release.sh ${{ needs.setup.outputs.release_name }} --src | ||
- name: Upload archive | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: ${{ github.job }}-artifacts | ||
path: dist | ||
retention-days: ${{ env.RETENTION_DAYS }} | ||
build-images: | ||
name: "Build compilation images" | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 30 | ||
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" | ||
platforms: "linux/arm64,linux/amd64" | ||
- 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@v4 | ||
- name: Login to GitHub Container Registry | ||
uses: docker/login-action@v2 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.repository_owner }} | ||
password: ${{ secrets.TOKEN_GITHUB }} | ||
- name: Setup QEMU | ||
uses: docker/setup-qemu-action@v2 | ||
- name: Setup Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
- name: ${{ matrix.name }} | ||
uses: docker/build-push-action@v5 | ||
with: | ||
file: ${{ matrix.file }} | ||
tags: ${{ matrix.tags }} | ||
platforms: ${{ matrix.platforms }} | ||
push: true | ||
cache-from: type=gha | ||
cache-to: type=gha,mode=max | ||
binary-ubuntu-bionic: | ||
name: "Build Ubuntu 18.04 (bionic) binary" | ||
needs: [setup, build-images] | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 120 | ||
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@v4 | ||
- 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@v4 | ||
with: | ||
name: ${{ github.job }}-artifacts | ||
path: dist | ||
retention-days: ${{ env.RETENTION_DAYS }} | ||
- uses: actions/upload-artifact@v4 | ||
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 | ||
timeout-minutes: 120 | ||
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@v4 | ||
- 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@v4 | ||
with: | ||
name: ${{ github.job }}-artifacts | ||
path: dist | ||
retention-days: ${{ env.RETENTION_DAYS }} | ||
- uses: actions/upload-artifact@v4 | ||
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 | ||
timeout-minutes: 120 | ||
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@v4 | ||
- 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@v4 | ||
with: | ||
name: ${{ github.job }}-artifacts | ||
path: dist | ||
retention-days: ${{ env.RETENTION_DAYS }} | ||
- uses: actions/upload-artifact@v4 | ||
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 | ||
timeout-minutes: 150 | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Setup QEMU | ||
uses: docker/setup-qemu-action@v2 | ||
- name: Login to GitHub Container Registry | ||
uses: docker/login-action@v2 | ||
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@v4 | ||
with: | ||
name: ${{ github.job }}-artifacts | ||
path: dist | ||
retention-days: ${{ env.RETENTION_DAYS }} | ||
- uses: actions/upload-artifact@v4 | ||
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 | ||
timeout-minutes: 120 | ||
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@v4 | ||
- 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@v4 | ||
with: | ||
name: ${{ github.job }}-artifacts | ||
path: dist | ||
retention-days: ${{ env.RETENTION_DAYS }} | ||
- uses: actions/upload-artifact@v4 | ||
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 | ||
timeout-minutes: 120 | ||
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@v4 | ||
- 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@v4 | ||
with: | ||
name: ${{ github.job }}-artifacts | ||
path: dist | ||
retention-days: ${{ env.RETENTION_DAYS }} | ||
- uses: actions/upload-artifact@v4 | ||
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 | ||
timeout-minutes: 120 | ||
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@v4 | ||
- 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@v4 | ||
with: | ||
name: ${{ github.job }}-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-macos: | ||
name: "Build macOS binary" | ||
needs: [setup, build-images] | ||
runs-on: macos-latest | ||
timeout-minutes: 120 | ||
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@v4 | ||
- name: Setup dependencies | ||
run: | | ||
brew install ninja openssh | ||
pip3 install --upgrade setuptools | ||
- 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: ${{ github.job }}-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/* | ||
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 | ||
timeout-minutes: ${{ fromJSON(vars.GHA_DEFAULT_TIMEOUT) }} | ||
steps: | ||
- name: Retrieve sibling release artifacts | ||
uses: actions/download-artifact@v4 | ||
with: | ||
pattern: *-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_version }} | ||
automatic_release_tag: ${{ 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_version }} | ||
automatic_release_tag: ${{ needs.setup.outputs.release_name }} | ||
repo_token: ${{ secrets.GITHUB_TOKEN }} | ||
files: | | ||
*.tar.gz |