--- # yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json name: Seerr Preview on: push: tags: - 'preview-*' workflow_dispatch: permissions: contents: read concurrency: group: preview-${{ github.ref }} cancel-in-progress: true jobs: build: name: Build (per-arch, native runners) strategy: matrix: include: - runner: ubuntu-24.04 platform: linux/amd64 arch: amd64 - runner: ubuntu-24.04-arm platform: linux/arm64 arch: arm64 runs-on: ${{ matrix.runner }} steps: - name: Checkout uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 with: persist-credentials: false - name: Commit timestamp id: ts run: echo "TIMESTAMP=$(git log -1 --pretty=%ct)" >> "$GITHUB_OUTPUT" - name: Set up Docker Buildx uses: docker/setup-buildx-action@e468171a9de216ec08956ac3ada2f0791b6bd435 # v3.11.1 - name: Derive preview version from tag id: ver shell: bash run: | TAG="${GITHUB_REF_NAME}" VER="${TAG#preview-}" VER="${VER#v}" echo "version=${VER}" >> "$GITHUB_OUTPUT" echo "Building preview version: ${VER}" - name: Warm cache (no push) — ${{ matrix.platform }} uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 # v6.18.0 with: context: . file: ./Dockerfile platforms: ${{ matrix.platform }} push: false build-args: | COMMIT_TAG=${{ github.sha }} BUILD_VERSION=${{ steps.ver.outputs.version }} SOURCE_DATE_EPOCH=${{ steps.ts.outputs.TIMESTAMP }} cache-from: type=gha,scope=${{ matrix.platform }} cache-to: type=gha,mode=max,scope=${{ matrix.platform }} provenance: false publish: name: Publish multi-arch image needs: build runs-on: ubuntu-24.04 permissions: contents: read packages: write id-token: write steps: - name: Checkout uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 with: persist-credentials: false - name: Commit timestamp id: ts run: echo "TIMESTAMP=$(git log -1 --pretty=%ct)" >> "$GITHUB_OUTPUT" - name: Set up Docker Buildx uses: docker/setup-buildx-action@e468171a9de216ec08956ac3ada2f0791b6bd435 # v3.11.1 - name: Log in to Docker Hub uses: docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef # v3.6.0 with: username: ${{ secrets.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_TOKEN }} - name: Log in to GitHub Container Registry uses: docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef # v3.6.0 with: registry: ghcr.io username: ${{ github.repository_owner }} password: ${{ secrets.GITHUB_TOKEN }} - name: Derive preview version from tag id: ver shell: bash run: | TAG="${GITHUB_REF_NAME}" VER="${TAG#preview-}" VER="${VER#v}" echo "version=${VER}" >> "$GITHUB_OUTPUT" echo "Publishing preview version: ${VER}" - name: Extract metadata id: meta uses: docker/metadata-action@c1e51972afc2121e065aed6d45c65596fe445f3f # v5.8.0 with: images: | ${{ github.repository }} ghcr.io/${{ github.repository }} tags: | type=raw,value=preview-${{ steps.ver.outputs.version }} labels: | org.opencontainers.image.version=preview-${{ steps.ver.outputs.version }} org.opencontainers.image.created=${{ steps.ts.outputs.TIMESTAMP }} - name: Build & Push (multi-arch, single tag) uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 # v6.18.0 with: context: . file: ./Dockerfile platforms: linux/amd64,linux/arm64 push: true build-args: | COMMIT_TAG=${{ github.sha }} BUILD_VERSION=${{ steps.ver.outputs.version }} SOURCE_DATE_EPOCH=${{ steps.ts.outputs.TIMESTAMP }} labels: ${{ steps.meta.outputs.labels }} tags: ${{ steps.meta.outputs.tags }} cache-from: | type=gha,scope=linux/amd64 type=gha,scope=linux/arm64 cache-to: type=gha,mode=max provenance: false