Skip to content

perf(web): flatten gdint/object ABI on the Go -> C++ bridge (#1442) #90

perf(web): flatten gdint/object ABI on the Go -> C++ bridge (#1442)

perf(web): flatten gdint/object ABI on the Go -> C++ bridge (#1442) #90

name: Publish Web Runtime Artifact
on:
push:
branches:
- dev
workflow_dispatch:
inputs:
target:
description: Branch name or full commit SHA to build
required: true
type: string
concurrency:
group: web-runtime-artifact-${{ github.event_name == 'workflow_dispatch' && inputs.target || github.sha }}
cancel-in-progress: false
jobs:
build:
name: Publish web runtime artifact
runs-on: ubuntu-latest
steps:
- name: Validate dispatch target
if: github.event_name == 'workflow_dispatch'
env:
TARGET: ${{ inputs.target }}
run: |
if [[ "${TARGET}" =~ ^[0-9a-f]{40}$ ]]; then
exit 0
fi
if [[ "${TARGET}" == refs/* ]]; then
echo "workflow_dispatch target must be a branch name or full commit SHA" >&2
exit 1
fi
if ! git check-ref-format --branch "${TARGET}" >/dev/null 2>&1; then
echo "invalid workflow_dispatch target: ${TARGET}" >&2
exit 1
fi
- name: Check out code
uses: actions/checkout@v6
with:
fetch-depth: 0
fetch-tags: true
ref: ${{ github.event_name == 'workflow_dispatch' && inputs.target || github.sha }}
- name: Install Linux dependencies
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install \
gcc \
libgl1-mesa-dev \
libegl1-mesa-dev \
libgles2-mesa-dev \
libx11-dev \
xorg-dev \
libasound2-dev \
libopenal-dev \
binaryen \
brotli
- name: Set up toolchain and engine assets
uses: ./.github/actions/deps
with:
setup-mode: web
web-mode: normal
- name: Set up ORAS
uses: oras-project/setup-oras@v1
- name: Compute pseudo-version
run: |
SPX_VERSION="$(go run ./.github/scripts/pseudo_version.go HEAD)"
echo "SPX_VERSION=${SPX_VERSION}"
echo "SPX_VERSION=${SPX_VERSION}" >> "${GITHUB_ENV}"
- name: Build web bundle
run: |
"$BUILDCTL" runtime export-web --mode normal
- name: Log in to GitHub Container Registry
uses: docker/login-action@v4
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ github.token }}
- name: Publish web bundle to GitHub Container Registry
run: |
REVISION="$(git rev-parse HEAD)"
oras push \
--artifact-type application/vnd.goplus.spx.web.bundle.v1 \
--annotation "org.opencontainers.image.source=https://github.com/${GITHUB_REPOSITORY}" \
--annotation "org.opencontainers.image.revision=${REVISION}" \
--annotation "org.opencontainers.image.version=${SPX_VERSION}" \
--annotation "org.opencontainers.image.title=spx_web.zip" \
--annotation "org.opencontainers.image.description=spx web runtime bundle" \
"ghcr.io/${GITHUB_REPOSITORY}:web-zip-${SPX_VERSION#v}" \
spx_web.zip:application/zip