feat: add sha/version tagging and feature branch support
All checks were successful
Build and push telegraf-snmp image / build-and-push-image (push) Successful in 2m38s
Build and push rsyncd image / build-and-push-image (push) Successful in 4m57s

This commit is contained in:
dresi 2026-06-11 09:22:52 +02:00
parent 847f078918
commit 18d0905531
3 changed files with 55 additions and 2 deletions

View File

@ -2,9 +2,14 @@ name: Build and push rsyncd image
run-name: ${{ gitea.actor }} is building and pushing rsyncd image
on:
push:
branches:
- main
- 'feat/**'
paths:
- 'rsyncd/**'
- '.gitea/workflows/rsyncd.yaml'
tags:
- 'v*'
env:
RESULT_IMAGE_NAME: tools/rsyncd
@ -28,6 +33,22 @@ jobs:
echo "${{ vars.PRIVATE_REGISTRY_CA_CERT }}" | sudo tee /usr/local/share/ca-certificates/private-ca.crt > /dev/null
sudo update-ca-certificates
- name: Compute image tags
id: tags
run: |
BASE="${{ vars.PRIVATE_REGISTRY_DOMAIN }}/${{ env.RESULT_IMAGE_NAME }}"
{
echo "value<<EOF"
echo "${BASE}:${{ gitea.sha }}"
if [ "${{ gitea.ref_name }}" = "main" ]; then
echo "${BASE}:latest"
fi
if [[ "${{ gitea.ref }}" == refs/tags/v* ]]; then
echo "${BASE}:${{ gitea.ref_name }}"
fi
echo "EOF"
} >> "$GITHUB_OUTPUT"
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
@ -44,4 +65,4 @@ jobs:
context: rsyncd
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ vars.PRIVATE_REGISTRY_DOMAIN }}/${{ env.RESULT_IMAGE_NAME }}:latest
tags: ${{ steps.tags.outputs.value }}

View File

@ -2,9 +2,14 @@ name: Build and push telegraf-snmp image
run-name: ${{ gitea.actor }} is building and pushing telegraf-snmp image
on:
push:
branches:
- main
- 'feat/**'
paths:
- 'telegraf-snmp/**'
- '.gitea/workflows/telegraf-snmp.yaml'
tags:
- 'v*'
env:
RESULT_IMAGE_NAME: tools/telegraf-snmp
@ -28,6 +33,22 @@ jobs:
echo "${{ vars.PRIVATE_REGISTRY_CA_CERT }}" | sudo tee /usr/local/share/ca-certificates/private-ca.crt > /dev/null
sudo update-ca-certificates
- name: Compute image tags
id: tags
run: |
BASE="${{ vars.PRIVATE_REGISTRY_DOMAIN }}/${{ env.RESULT_IMAGE_NAME }}"
{
echo "value<<EOF"
echo "${BASE}:${{ gitea.sha }}"
if [ "${{ gitea.ref_name }}" = "main" ]; then
echo "${BASE}:latest"
fi
if [[ "${{ gitea.ref }}" == refs/tags/v* ]]; then
echo "${BASE}:${{ gitea.ref_name }}"
fi
echo "EOF"
} >> "$GITHUB_OUTPUT"
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
@ -44,4 +65,4 @@ jobs:
context: telegraf-snmp
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ vars.PRIVATE_REGISTRY_DOMAIN }}/${{ env.RESULT_IMAGE_NAME }}:latest
tags: ${{ steps.tags.outputs.value }}

11
README.md Normal file
View File

@ -0,0 +1,11 @@
# container-images
## CI Workflows
| Trigger | Tags gebaut |
|---|---|
| Push auf `feat/**` | `:<sha>` |
| Push/Merge auf `main` | `:<sha>` + `:latest` |
| `git tag v1.0.0 && git push origin v1.0.0` | `:<sha>` + `:v1.0.0` |
`:latest` wird nur durch Pushes auf `main` überschrieben. Feature-Branches bauen immer, lassen `:latest` aber unberührt.