sesame/.forgejo/workflows/build-images.yml
Marc Cataford 795e977532
All checks were successful
/ pre-run (push) Successful in 24s
/ build (push) Successful in 1m25s
/ post-run (push) Successful in 26s
ci: remove push redundant calls
2024-11-07 19:58:24 -05:00

58 lines
1.9 KiB
YAML

on:
workflow_dispatch:
push:
tags:
- "v*"
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:
needs: [pre-run]
runs-on: imagefactory-latest
steps:
- uses: actions/checkout@v4
- name: Setup Spud
uses: https://forge.karnov.club/spadinastan/setup-spud-action@feat/install-spud-in-env
- name: Login to Registry
run: podman login -u ${{ secrets.REGISTRY_USER }} -p ${{ secrets.REGISTRY_TOKEN }} ${{ vars.REGISTRY_ENDPOINT }}
- name: Set image metadata
id: image-metadata
run: |
echo "image-tag=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
- name: Build images
run: |
spud build -d ./service.yml
podman image ls
- name: Push tagged images to registry
if: ${{ github.event_name == 'push' }}
run: |
for image in $(podman image ls --format {{ .Repository }} | grep localhost/sesame)
do
for tag in latest ${{ steps.image-metadata.outputs.image-tag }} ${{ github.ref_name }}
do
podman push $image:latest ${{ vars.REGISTRY_ENDPOINT }}/$image:$tag
done
done
post-run:
runs-on: imagefactory-latest
needs: [build]
steps:
- uses: https://forge.karnov.club/marc/push-status-to-discord-action@main
if: ${{always() && 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: ${{always() && failure()}}
with:
webhook-url: ${{secrets.DISCORD_WEBHOOK_URL}}
status: "Failure"
variant: "failure"