2026-07-03 22:32:55 +00:00
|
|
|
name: Image Build Probe
|
|
|
|
|
|
|
|
|
|
on:
|
|
|
|
|
push:
|
|
|
|
|
paths:
|
|
|
|
|
- ".forgejo/workflows/image-build.yaml"
|
|
|
|
|
- "Dockerfile"
|
|
|
|
|
workflow_dispatch:
|
|
|
|
|
|
|
|
|
|
env:
|
|
|
|
|
REGISTRY: forgejo.coulomb.social
|
|
|
|
|
IMAGE_NAME: coulomb/forgejo-actions-probe
|
2026-07-03 22:36:50 +00:00
|
|
|
DOCKER_HOST: tcp://127.0.0.1:2375
|
2026-07-03 22:32:55 +00:00
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
|
image-build:
|
|
|
|
|
runs-on: container-build
|
|
|
|
|
steps:
|
|
|
|
|
- name: Checkout
|
|
|
|
|
uses: actions/checkout@v4
|
|
|
|
|
|
2026-07-03 22:41:51 +00:00
|
|
|
- name: Build and push image
|
|
|
|
|
env:
|
|
|
|
|
REGISTRY_USER: ${{ secrets.REGISTRY_USER }}
|
|
|
|
|
REGISTRY_TOKEN: ${{ secrets.REGISTRY_TOKEN }}
|
2026-07-03 22:36:50 +00:00
|
|
|
run: |
|
|
|
|
|
set -eu
|
2026-07-03 22:39:53 +00:00
|
|
|
mkdir -p "${HOME}/bin"
|
|
|
|
|
wget -qO- https://download.docker.com/linux/static/stable/x86_64/docker-27.3.1.tgz | tar xz --strip-components=1 -C "${HOME}/bin" docker/docker
|
2026-07-03 22:41:51 +00:00
|
|
|
export PATH="${HOME}/bin:${PATH}"
|
|
|
|
|
docker version
|
|
|
|
|
echo "${REGISTRY_TOKEN}" | docker login "${REGISTRY}" -u "${REGISTRY_USER}" --password-stdin
|
2026-07-03 22:32:55 +00:00
|
|
|
TAG="${GITHUB_SHA:-manual}"
|
|
|
|
|
SHORT="${TAG:0:7}"
|
|
|
|
|
IMAGE="${REGISTRY}/${IMAGE_NAME}"
|
|
|
|
|
docker build -t "${IMAGE}:latest" -t "${IMAGE}:${SHORT}" .
|
|
|
|
|
docker push "${IMAGE}:latest"
|
|
|
|
|
docker push "${IMAGE}:${SHORT}"
|
|
|
|
|
echo "pushed ${IMAGE}:latest and ${IMAGE}:${SHORT}"
|