invidious/.github/workflows/build-arik-container.yml
NeskireDK 0db4d8e682 CI: publish :latest from the arik branch only
The build job had no branch condition and tagged :latest on every run.
A workflow_dispatch on a work branch would therefore publish that branch
to ghcr.io, and Watchtower would deploy it to production the same night.

With the guard, a dispatch on a work branch runs the test job alone —
crystal spec plus the warning-clean build — on a GitHub runner. That is
how this branch gets type-checked: the compiler needs more memory than
LXC 108 has.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-13 08:38:34 +02:00

90 lines
2.2 KiB
YAML

name: Build ArikTube container
on:
workflow_dispatch:
push:
branches:
- arik
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
submodules: true
- name: Install required APT packages
run: sudo apt install -y libsqlite3-dev
- name: Install Crystal
uses: crystal-lang/install-crystal@v1.9.2
with:
crystal: 1.20.3
- name: Cache Shards
uses: actions/cache@v6
with:
path: |
./lib
./bin
key: shards-${{ hashFiles('shard.lock') }}
- name: Install Shards
run: |
if ! shards check; then
shards install --skip-postinstall --skip-executables
fi
- name: Run tests
run: crystal spec
- name: Build
run: crystal build --warnings all --error-on-warnings --error-trace src/invidious.cr
build:
needs: test
# Only the arik branch publishes :latest — production pulls that tag through
# Watchtower. A dispatch on any other branch runs the test job alone, which
# is how a work branch gets type-checked without shipping itself.
if: github.ref == 'refs/heads/arik'
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v6
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v4
- name: Login to registry
uses: docker/login-action@v4
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Docker meta
id: meta
uses: docker/metadata-action@v6
with:
images: ghcr.io/neskiredk/invidious
flavor: |
latest=false
tags: |
type=raw,value=latest
type=sha
- name: Build and push
uses: docker/build-push-action@v7
with:
context: .
file: docker/Dockerfile
platforms: linux/amd64
labels: ${{ steps.meta.outputs.labels }}
push: true
tags: ${{ steps.meta.outputs.tags }}
build-args: |
"release=1"