Skip to content

Docker

Docker #485

name: Docker
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
on:
schedule:
- cron: "32 19 * * *"
push:
# Publish semver tags as releases.
tags: ["v*.*.*"]
workflow_dispatch:
workflow_call:
env:
# Use docker.io for Docker Hub if empty
REGISTRY: ghcr.io
# github.repository as <account>/<repo>
IMAGE_NAME: ${{ github.repository }}
jobs:
docker_build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
# This is used to complete the identity challenge
# with sigstore/fulcio when running outside of PRs.
id-token: write
steps:
- uses: cachix/install-nix-action@v30
- uses: DeterminateSystems/magic-nix-cache-action@v8
- name: Checkout repository
uses: actions/checkout@v4
- name: Determine whether to push
id: docker_pushable
run: echo should=${{ toJSON(github.event_name != 'pull_request' && github.event_name != 'merge_group') }} >>$GITHUB_OUTPUT
- name: Build the docker images we care about
run: |
nix build .#tsnsrvOciImage-cross-aarch64-linux .#tsnsrvOciImage
# Login against a Docker registry except on PR
# https://github.com/docker/login-action
- name: Log into registry ${{ env.REGISTRY }}
if: steps.docker_pushable.outputs.should == 'true'
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Push to ghcr
if: steps.docker_pushable.outputs.should == 'true'
run: nix run .#pushImagesToGhcr --impure