ci:workflow
Some checks failed
Build and Push App Image / build-and-push (push) Has been cancelled

This commit is contained in:
domrichardson
2026-03-24 16:10:13 +00:00
parent df40cc57e1
commit e2b87c64f4

View File

@@ -0,0 +1,52 @@
name: Build and Push App Image
on:
push:
branches:
- main
- master
tags:
- "v*"
workflow_dispatch:
env:
# Example: registry.example.com/your-user/noteapp
IMAGE_NAME: ${{ secrets.REGISTRY_IMAGE }}
jobs:
build-and-push:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set image tags
id: vars
shell: bash
run: |
SHORT_SHA="${GITHUB_SHA::7}"
BRANCH="${GITHUB_REF_NAME//\//-}"
echo "short_sha=${SHORT_SHA}" >> "$GITHUB_OUTPUT"
echo "branch=${BRANCH}" >> "$GITHUB_OUTPUT"
- name: Login to Gitea Container Registry
uses: docker/login-action@v3
with:
registry: ${{ secrets.REGISTRY_HOST }}
username: ${{ secrets.REGISTRY_USERNAME }}
password: ${{ secrets.REGISTRY_PASSWORD }}
- name: Build and push app image
uses: docker/build-push-action@v6
with:
context: .
file: ./devops/docker/Dockerfile
push: true
build-args: |
VITE_API_BASE_URL=${{ secrets.VITE_API_BASE_URL }}
tags: |
${{ env.IMAGE_NAME }}:latest
${{ env.IMAGE_NAME }}:${{ steps.vars.outputs.short_sha }}
${{ env.IMAGE_NAME }}:${{ steps.vars.outputs.branch }}