forgejo-actions-probe/.forgejo/workflows/image-build.yaml

38 lines
958 B
YAML
Raw Normal View History

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
jobs:
image-build:
runs-on: container-build
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Login to Forgejo registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ secrets.REGISTRY_USER }}
password: ${{ secrets.REGISTRY_TOKEN }}
- 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}"