Skip to content

Build plugin artifacts #37

Build plugin artifacts

Build plugin artifacts #37

Workflow file for this run

name: Build plugin artifacts
# Builds every addon (or one) to prove the tree compiles.
# It publishes nothing and uploads no artifacts: to get a downloadable URL,
# run "Publish addons" with staging: true.
on:
workflow_dispatch:
inputs:
codeonthego_ref:
description: CodeOnTheGo branch or tag to build the libs against
required: false
default: stage
plugin:
description: One addon directory name, e.g. Random-XKCD (blank builds all)
required: false
default: ''
permissions:
contents: read
jobs:
build:
runs-on: ubuntu-latest
timeout-minutes: 45
steps:
- name: Checkout plugin-examples
uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: '17'
- name: Install uv
uses: astral-sh/setup-uv@v5
- name: Set up Gradle
uses: gradle/actions/setup-gradle@v3
with:
cache-disabled: true
add-job-summary: 'never'
- name: Build libs and plugins
env:
CODEONTHEGO_REF: ${{ github.event.inputs.codeonthego_ref }}
ONLY_PLUGIN: ${{ github.event.inputs.plugin }}
run: |
if [ -n "$ONLY_PLUGIN" ]; then
./scripts/update-libs.sh --ref "$CODEONTHEGO_REF" --plugin "$ONLY_PLUGIN"
else
./scripts/update-libs.sh --ref "$CODEONTHEGO_REF"
fi
- name: Check every addon produced a release .cgp
env:
ONLY_PLUGIN: ${{ inputs.plugin }}
run: |
set -euo pipefail
# --include-skipped, the same list scripts/update-libs.sh builds and
# resolves --plugin against. An addon merely held out of the gallery
# is still built here and must still package, and a single-addon run
# naming one has to find it in this list. Only "!" entries in
# skip.txt are absent from both.
all="$(uv run --directory tools/addons addons --root "$GITHUB_WORKSPACE" discover --include-skipped)"
# A single-plugin run only builds that module, so the others have no
# .cgp by design and must not be reported as missing.
if [ -n "$ONLY_PLUGIN" ]; then
all="$(printf '%s\n' "$all" | grep -Fx -e "$ONLY_PLUGIN" -e "plugins/$ONLY_PLUGIN" || true)"
# Never let a no-match end the step on grep's bare exit 1: that
# reports a build that in fact succeeded as a red run, with no
# line saying why.
if [ -z "$all" ]; then
echo "ERROR: '${ONLY_PLUGIN}' is not a known addon, so nothing was checked." >&2
exit 1
fi
fi
missing=0
for dir in $all; do
if ! find "$dir/build/plugin" -name '*.cgp' ! -name '*-debug.cgp' 2>/dev/null | grep -q .; then
echo "ERROR: no release .cgp under ${dir}/build/plugin/"
missing=$((missing + 1))
fi
done
[ "$missing" -eq 0 ] || exit 1
echo "Every discovered addon produced a release .cgp."