ci: build images on tag push and trigger, push to registry
This commit is contained in:
parent
055c240396
commit
5ae73171b4
1 changed files with 60 additions and 0 deletions
60
.forgejo/workflows/build-images.yml
Normal file
60
.forgejo/workflows/build-images.yml
Normal file
|
@ -0,0 +1,60 @@
|
|||
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 }} ${{ var.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 Caddy image to registry
|
||||
if: ${{ github.event_name == 'push' }}
|
||||
run: |
|
||||
podman push localhost/sesame-caddy:latest ${{ var.REGISTRY_ENDPOINT }}/sesame/caddy:latest
|
||||
podman push localhost/sesame-caddy:latest ${{ var.REGISTRY_ENDPOINT }}/sesame/caddy:${{ steps.image-metadata.outputs.image-tag }}
|
||||
podman push localhost/sesame-caddy:latest ${{ var.REGISTRY_ENDPOINT }}/sesame/caddy:${{ github.ref_name }}
|
||||
- name: Push tagged Promtail image to registry
|
||||
if: ${{ github.event_name == 'push' }}
|
||||
run: |
|
||||
podman push localhost/sesame-promtail:latest ${{ var.REGISTRY_ENDPOINT }}/sesame/promtail:latest
|
||||
podman push localhost/sesame-promtail:latest ${{ var.REGISTRY_ENDPOINT }}/sesame/promtail:${{ steps.image-metadata.outputs.image-tag }}
|
||||
podman push localhost/sesame-promtail:latest ${{ var.REGISTRY_ENDPOINT }}/sesame/promtail:${{ github.ref_name }}
|
||||
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"
|
Loading…
Reference in a new issue