Files
backupbot/.gitea/workflows/build.yml
Chris Cowan bbc5245793
Some checks failed
Docker Image CI / build-and-push-image (push) Has been cancelled
testing new workflow
2025-10-23 14:57:42 -07:00

54 lines
1.5 KiB
YAML

name: Docker Image CI
on:
push:
branches:
- "main"
tags:
- "*" # This triggers the workflow on any tag push
jobs:
build-and-push-image:
runs-on: ubuntu-latest
container:
image: catthehacker/ubuntu:act-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: gitea.calahilstudios.com
username: ${{ secrets.REGISTRY_USER }}
password: ${{ secrets.REGISTRY_TOKEN }}
- name: Prepare tags
id: prepare_tags
run: |
# The image reference for your Gitea registry
IMAGE_REF=gitea.calahilstudios.com/calahil/backupbot
# The main tags: latest and commit SHA
TAGS="${IMAGE_REF}:latest,${IMAGE_REF}:${{ gitea.sha }}"
# If the event is a tag push, add the git tag as a tag
if [[ "${{ gitea.ref_type }}" == "tag" ]]; then
GIT_TAG_NAME=$(basename "${{ gitea.ref }}")
TAGS="${TAGS},${IMAGE_REF}:${GIT_TAG_NAME}"
fi
# Set the tags as a step output
echo "DOCKER_TAGS=${TAGS}" >> $GITEA_ENV
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: ${{ steps.prepare_tags.outputs.DOCKER_TAGS }}