tests / test (pull_request_target) Successful in 6m38s
mirror/github-mirror.sh publishes main and the tags on it to a read-only GitHub mirror, as one extra commit that adds a notice under the README title, so every forge commit is unchanged there and each sync is a fast-forward. A systemd user service and hourly timer run it from a host that can push to GitHub; --settings turns off issues, pull requests and the rest there. A GitHub Actions workflow builds the image on the mirror and pushes it to ghcr.io, freeing runner disk first since the CUDA build of torch is several GB. docker-compose.yml names the image after IMAGE_PREFIX and IMAGE_TAG, so setting them pulls the published image instead of building, and the README says how.
63 lines
1.8 KiB
YAML
63 lines
1.8 KiB
YAML
# Builds the songtrace image on the GitHub mirror and pushes it to GitHub's
|
|
# container registry, under the repository's owner. Gitea ignores this
|
|
# directory while .gitea/workflows exists, so the forge does not run it.
|
|
name: Images
|
|
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
tags: ['v*.*.*']
|
|
workflow_dispatch:
|
|
|
|
permissions:
|
|
contents: read
|
|
packages: write
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
# The image carries CUDA builds of torch, several GB of them, which is
|
|
# more than a hosted runner has free until its preinstalled toolchains
|
|
# are gone.
|
|
- name: Free disk space
|
|
run: |
|
|
sudo rm -rf /usr/share/dotnet /usr/local/lib/android /opt/ghc \
|
|
/opt/hostedtoolcache/CodeQL /usr/local/share/boost
|
|
sudo docker image prune --all --force
|
|
df -h /
|
|
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Lowercase the owner
|
|
id: owner
|
|
shell: bash
|
|
run: echo "name=${GITHUB_REPOSITORY_OWNER,,}" >> "$GITHUB_OUTPUT"
|
|
|
|
- uses: docker/setup-buildx-action@v3
|
|
|
|
- uses: docker/login-action@v3
|
|
with:
|
|
registry: ghcr.io
|
|
username: ${{ github.actor }}
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- id: meta
|
|
uses: docker/metadata-action@v5
|
|
with:
|
|
images: ghcr.io/${{ steps.owner.outputs.name }}/songtrace
|
|
tags: |
|
|
type=semver,pattern={{version}}
|
|
type=semver,pattern={{major}}.{{minor}}
|
|
type=raw,value=latest,enable=${{ startsWith(github.ref, 'refs/tags/v') }}
|
|
type=ref,event=branch
|
|
|
|
- uses: docker/build-push-action@v6
|
|
with:
|
|
context: .
|
|
push: true
|
|
tags: ${{ steps.meta.outputs.tags }}
|
|
labels: ${{ steps.meta.outputs.labels }}
|
|
platforms: linux/amd64
|
|
provenance: false
|