# Builds the image and pushes it to the forge's own registry on every push
# to master, tagged :master, :latest and the commit sha. keel polls
# ggr.neiam.co/neiam/fieri-forever:master and rolls the Deployment
# (argo-01-bos/fieri-eternal/app.yml).
#
# No secrets: the per-job token is accepted by the registry's /v2/token
# endpoint for pushes to this repository's own image path. Same workflow as
# dms and big_tripper.
name: image
on:
push:
branches: [master]
jobs:
image:
runs-on: self-hosted
steps:
- uses: actions/checkout@v4
- uses: docker/setup-buildx-action@v3
# An unset CI_REGISTRY resolves to the empty string, and login-action
# then silently defaults to docker.io. Say what's missing instead.
- name: Check the registry variable is set
env:
CI_REGISTRY: ${{ vars.CI_REGISTRY }}
run: |
set -euo pipefail
if [ -z "${CI_REGISTRY:-}" ]; then
echo "CI_REGISTRY is not set for this repository." >&2
echo "Set it as an organisation-level Actions variable (the" >&2
echo "registry hostname), the same one the other neiam apps use." >&2
exit 1
fi
echo "pushing to $CI_REGISTRY"
# The username is ignored by the token endpoint but login-action
# requires it to be non-empty.
- uses: docker/login-action@v3
with:
registry: ${{ vars.CI_REGISTRY }}
username: ci
password: ${{ github.token }}
- uses: docker/metadata-action@v5
id: meta
with:
images: ${{ vars.CI_REGISTRY }}/${{ github.repository }}
tags: |
type=sha,format=long
type=ref,event=branch
# Unconditional: `{{is_default_branch}}` evaluates false on this
# forge. The workflow only runs on master anyway.
type=raw,value=latest
- uses: docker/build-push-action@v6
with:
context: .
file: ./Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=registry,ref=${{ vars.CI_REGISTRY }}/${{ github.repository }}:buildcache
cache-to: type=registry,ref=${{ vars.CI_REGISTRY }}/${{ github.repository }}:buildcache,mode=max
neiam
/fieri-forever
the flavortown lunch engine
public · Issues · Pulls · Labels · Forks · Compare · Actions success · Badges · Packages
⭐
Log in to mark this repository.
2.3 KiB · text
History
a7c4c3c