Skip to content

Update examples README #6

Update examples README

Update examples README #6

Workflow file for this run

# Publishes the host-side Go binaries (owncast-plugin-serve, owncast-plugin-test)
# as release assets when a v* tag is pushed. The SDK's npm postinstall
# (sdks/js/scripts/postinstall.js) downloads them from
# https://github.com/owncast/plugin-sdk/releases/download/v<version>/<binary>-<goos>-<goarch>
# so the asset names below must stay in lockstep with hostBinaryURL() there.
#
# The tag must match the SDK package version: postinstall fetches
# v${require("sdks/js/package.json").version}. Cut the tag accordingly
# (e.g. package.json 0.1.0 -> tag v0.1.0).
#
# Layout: a per-platform build matrix uploads its binaries as workflow
# artifacts, then a single release job collects all of them and creates the
# GitHub release in one shot. (An earlier matrix-only design had every job
# call softprops in parallel, racing to create the same release, which is
# how v0.1.0's linux-arm64 assets first went missing.)
name: Release host binaries
on:
push:
tags:
- "v*"
permissions:
contents: write
jobs:
build:
name: build ${{ matrix.goos }}-${{ matrix.goarch }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- goos: linux
goarch: amd64
- goos: linux
goarch: arm64
- goos: darwin
goarch: amd64
- goos: darwin
goarch: arm64
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version-file: host-runtime/go.mod
cache-dependency-path: host-runtime/go.sum
# Pure-Go (wazero) runtime, so every target cross-compiles from the
# ubuntu runner with CGO disabled, no per-OS runner needed.
- name: Build host binaries
working-directory: host-runtime
env:
GOOS: ${{ matrix.goos }}
GOARCH: ${{ matrix.goarch }}
CGO_ENABLED: "0"
run: |
suffix="${GOOS}-${GOARCH}"
mkdir -p "${GITHUB_WORKSPACE}/dist"
for bin in owncast-plugin-serve owncast-plugin-test; do
out="${GITHUB_WORKSPACE}/dist/${bin}-${suffix}"
go build -trimpath \
-ldflags="-s -w -X main.version=${GITHUB_REF_NAME}" \
-o "${out}" "./cmd/${bin}"
# Gzip to roughly halve download size; matches how extism-js ships
# and postinstall already gunzips it on the fly.
gzip -9 -f "${out}"
done
- name: Upload binaries as artifact
uses: actions/upload-artifact@v4
with:
name: host-binaries-${{ matrix.goos }}-${{ matrix.goarch }}
path: dist/*
if-no-files-found: error
release:
name: publish release
needs: build
runs-on: ubuntu-latest
steps:
- name: Download all build artifacts
uses: actions/download-artifact@v4
with:
path: dist
# All matrix uploads land directly under dist/ rather than each in
# its own subdir, so softprops's `files: dist/*` picks them up.
merge-multiple: true
pattern: host-binaries-*
- name: Create GitHub release and upload assets
uses: softprops/action-gh-release@v2
with:
files: dist/*
fail_on_unmatched_files: true