Files
HabitTracker/.gitea/workflows/docker-simple.yml
jafreli fbebb084d0
All checks were successful
Build and Push Docker Image / build-and-push (push) Successful in 2m12s
Update worckflow
2025-07-24 21:51:25 +02:00

68 lines
1.8 KiB
YAML

name: Build and Push Docker Image
on:
push:
branches:
- main
- master
pull_request:
branches:
- main
- master
release:
types: [published]
env:
REGISTRY: git.out.jafre.li
IMAGE_NAME: ${{ gitea.repository }}
jobs:
build-and-push:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to Gitea Container Registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ gitea.actor }}
password: ${{ secrets.TOKEN }}
- name: Extract metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=raw,value=latest,enable={{is_default_branch}}
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: .
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
build-args: |
SOURCE_URL=${{ gitea.server_url }}/${{ gitea.repository }}
REPO_NAME=${{ gitea.repository }}
- name: Generate deployment info
run: |
echo "Docker image pushed successfully!"
echo "Image: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}"
echo "Tags: ${{ steps.meta.outputs.tags }}"