42 lines
1.1 KiB
YAML
42 lines
1.1 KiB
YAML
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
|
|
DOCKER_HOST: tcp://127.0.0.1:2375
|
|
|
|
jobs:
|
|
image-build:
|
|
runs-on: container-build
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Install docker CLI
|
|
run: |
|
|
set -eu
|
|
apk add --no-cache docker-cli
|
|
docker version
|
|
|
|
- name: Login to Forgejo registry
|
|
run: |
|
|
set -eu
|
|
echo "${{ secrets.REGISTRY_TOKEN }}" | docker login "${REGISTRY}" -u "${{ secrets.REGISTRY_USER }}" --password-stdin
|
|
|
|
- name: Build and push
|
|
run: |
|
|
set -eu
|
|
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}"
|