diff --git a/.forgejo/workflows/image-build.yaml b/.forgejo/workflows/image-build.yaml new file mode 100644 index 0000000..b17b3d5 --- /dev/null +++ b/.forgejo/workflows/image-build.yaml @@ -0,0 +1,37 @@ +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}"