60 lines
2.2 KiB
YAML
60 lines
2.2 KiB
YAML
on:
|
|
push:
|
|
tags:
|
|
- "*-v*"
|
|
workflow_dispatch:
|
|
|
|
env:
|
|
REGISTRY_ENDPOINT: host.containers.internal:5000
|
|
|
|
jobs:
|
|
pre-run:
|
|
runs-on: imagefactory-latest
|
|
steps:
|
|
- uses: https://forge.karnov.club/marc/push-status-to-discord-action@main
|
|
with:
|
|
webhook-url: ${{secrets.DISCORD_WEBHOOK_URL}}
|
|
status: "Started"
|
|
init: true
|
|
build-runner:
|
|
needs: [pre-run]
|
|
runs-on: imagefactory-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: actions/setup-python@v5
|
|
with:
|
|
python-version: 3.12
|
|
- name: Login to Registry
|
|
run: podman login -u ${{ secrets.REGISTRY_USER }} -p ${{ secrets.REGISTRY_TOKEN }} ${{ env.REGISTRY_ENDPOINT }}
|
|
- name: Set image metadata
|
|
id: image-metadata
|
|
run: |
|
|
echo "image-tag=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
|
|
echo "full-image-name=debian-12.6-slim:$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
|
|
- name: Build image
|
|
run: python ./build_image.py ${{ steps.image-metadata.outputs.full-image-name }} ./images/debian-12.6-slim/Dockerfile
|
|
- name: Tag image as latest
|
|
run: podman tag ${{ steps.image-metadata.outputs.full-image-name }} debian-12.6-slim:latest
|
|
- name: List images
|
|
run: podman image ls
|
|
- name: Push tagged image to registry
|
|
if: ${{ github.event_name == 'push' }}
|
|
run: |
|
|
podman push ${{ steps.image-metadata.outputs.full-image-name }} ${{ env.REGISTRY_ENDPOINT }}/forge-runners/${{ steps.image-metadata.outputs.full-image-name }}
|
|
podman push ${{ steps.image-metadata.outputs.full-image-name }} ${{ env.REGISTRY_ENDPOINT }}/forge-runners/debian-12.6-slim:latest
|
|
post-run:
|
|
runs-on: imagefactory-latest
|
|
needs: [build-runner]
|
|
steps:
|
|
- uses: https://forge.karnov.club/marc/push-status-to-discord-action@main
|
|
if: ${{success()}}
|
|
with:
|
|
webhook-url: ${{secrets.DISCORD_WEBHOOK_URL}}
|
|
status: "Success"
|
|
variant: "success"
|
|
- uses: https://forge.karnov.club/marc/push-status-to-discord-action@main
|
|
if: ${{failure()}}
|
|
with:
|
|
webhook-url: ${{secrets.DISCORD_WEBHOOK_URL}}
|
|
status: "Failure"
|
|
variant: "failure"
|