runner-images/.forgejo/workflows/ci.yml
Marc Cataford 32ffc099d3
Some checks failed
/ build-images (ubuntu-2204) (push) Has been cancelled
/ post-run (push) Has been cancelled
/ pre-run (push) Has been cancelled
ci: add discordops via webhook
2024-07-21 13:25:34 -04:00

57 lines
2.1 KiB
YAML

on:
push:
tags:
- "*-v*"
env:
REGISTRY_ENDPOINT: host.containers.internal:5000
jobs:
pre-run:
runs-on: ubuntu-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-images:
runs-on: ubuntu-latest
strategy:
matrix:
image-name: ['ubuntu-2204']
steps:
- uses: actions/checkout@v4
- 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=$(./script/get-tag.sh)" >> $GITHUB_OUTPUT
echo "full-image-name=${{ matrix.image-name }}:$(./script/get-tag.sh)" >> $GITHUB_OUTPUT
- name: Build image
run: ./script/build-image.sh ${{ matrix.image-name }} ${{ steps.image-metadata.outputs.image-tag }}
- name: Tag image as latest
run: podman tag ${{ steps.image-metadata.outputs.full-image-name }} ${{ matrix.image-name }}:latest
- name: List images
run: podman image ls
- name: Push tagged image to registry
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/${{ matrix.image-name }}:latest
post-run:
runs-on: ubuntu-latest
needs: [build-images]
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"