okami.mom/strata
git clone https://git.nkp.pet/okami.mom/strata
df20d7784
main
1name : Docker images 2 3# Builds the Strata container images of one release from its engine packages and pushes them to ghcr.io. 4# Run by hand only (Actions tab -> Docker images -> Run workflow). Nothing starts it on its own. 5# 6# For each flavor the job downloads the engine package from the release and checks it against the signed update feed 7# (docker/fetch-engines.py: the feed's Ed25519 signature, the archive's SHA-256, the manifest hash, the package signature, 8# every file's hash), builds the image with docker/build.sh and, only when "push" is on, pushes 9# ghcr.io/niko1221/strata:<version>-<flavor> and ghcr.io/niko1221/strata:latest-<flavor> 10# The first run with "push" off builds everything without publishing it (a dry run). 11 12on : 13workflow_dispatch : 14inputs : 15release_tag : 16description : 'Release tag whose engine packages go into the images (for example v0.2.7)' 17required : true 18type : string 19flavors : 20description : 'Flavors to build, comma separated (empty: every flavor the release has a package for)' 21required : false 22default : '' 23type : string 24push : 25description : 'Push the images to ghcr.io (off: build only, nothing is published)' 26required : true 27default : false 28type : boolean 29latest : 30description : 'Also move the latest-<flavor> tags (turn off for a pre-release or a test)' 31required : true 32default : true 33type : boolean 34source_ref : 35description : 'Git ref of the Dockerfile and the Terminal sources (empty: the release tag)' 36required : false 37default : '' 38type : string 39 40permissions : 41contents : read 42 43env : 44IMAGE : ghcr.io/niko1221/strata 45 46jobs : 47plan : 48runs-on : ubuntu-24.04 49outputs : 50flavors : ${{ steps.list.outputs.flavors }} 51steps : 52- uses : actions/checkout@v4 53with : 54ref : ${{ inputs.source_ref || inputs.release_tag }} 55- name : Which flavors does the release have a package for 56id : list 57env : 58WANT : ${{ inputs.flavors }} 59TAG : ${{ inputs.release_tag }} 60run : | 61set -eu 62args="--release-tag $TAG --list --skip-missing" 63[ -n "$WANT" ] && args="$args --flavors $WANT" 64python3 docker/fetch-engines.py $args > list.tsv 65cat list.tsv 66flavors=$(awk -F'\t' '$3 != "SKIP" {printf "%s\"%s\"", (n++ ? "," : ""), $1}' list.tsv) 67[ -n "$flavors" ] || { echo "the release has no engine package for any requested flavor"; exit 1; } 68echo "flavors=[$flavors]" >> "$GITHUB_OUTPUT" 69 70image : 71needs : plan 72runs-on : ubuntu-24.04 73timeout-minutes : 120 74permissions : 75contents : read 76packages : write 77strategy : 78fail-fast : false 79max-parallel : 3 80matrix : 81flavor : ${{ fromJSON(needs.plan.outputs.flavors) }} 82steps : 83- uses : actions/checkout@v4 84with : 85ref : ${{ inputs.source_ref || inputs.release_tag }} 86- name : Free disk space (the runner has about 14 GB; a package plus its image needs about 10 GB) 87run : | 88sudo rm -rf /usr/share/dotnet /usr/local/lib/android /opt/ghc /opt/hostedtoolcache/CodeQL || true 89docker system prune -af >/dev/null 2>&1 || true 90df -h / 91- name : Log in to ghcr.io 92if : ${{ inputs.push }} 93env : 94REGISTRY_TOKEN : ${{ secrets.GITHUB_TOKEN }} 95REGISTRY_USER : ${{ github.actor }} 96run : printf '%s' "$REGISTRY_TOKEN" | docker login ghcr.io -u "$REGISTRY_USER" --password-stdin 97- name : Fetch, verify, build (and push when push is on) 98env : 99TAG : ${{ inputs.release_tag }} 100FLAVOR : ${{ matrix.flavor }} 101PUSH : ${{ inputs.push && '--push' || '' }} 102LATEST : ${{ !inputs.latest && '--no-latest' || '' }} 103run : | 104docker/publish.sh --release-tag "$TAG" --flavors "$FLAVOR" --image "$IMAGE" $PUSH $LATEST 105- name : Summary 106if : ${{ always() }} 107run : | 108{ 109echo "### ${{ matrix.flavor }}" 110echo "- release: ${{ inputs.release_tag }}, pushed: ${{ inputs.push }}" 111echo "- image: \`$IMAGE:${INPUT_TAG#v}-${{ matrix.flavor }}\`" 112} >> "$GITHUB_STEP_SUMMARY" 113env : 114INPUT_TAG : ${{ inputs.release_tag }}