First attempt with workflows
ci / tsan (C++17, tsan) (push) Waiting to run
ci / ubsan (C++17, ubsan) (push) Waiting to run
ci / results (push) Blocked by required conditions
Build & Push Docker image / build-and-push (push) Has been cancelled
ci / g++11.3.0 (C++17, Debug) (push) Has been cancelled
ci / g++12.3.0 (C++20, Debug) (push) Has been cancelled
ci / g++13.3.0 (C++20, Debug) (push) Has been cancelled
ci / g++14.3.0 (C++20, Debug) (push) Has been cancelled
ci / g++9.4.0 (C++17, Debug) (push) Has been cancelled
Gitea Actions Demo / Explore-Gitea-Actions (push) Has been cancelled
ci / clang20 (C++17, Debug) (push) Failing after 3m29s
ci / g++10.3.0 (C++17, Debug) (push) Has been cancelled
ci / clang15 (C++17, Debug) (push) Failing after 54s
ci / clang17 (C++17, Debug) (push) Failing after 54s
ci / clang18 (C++17, Debug) (push) Failing after 52s
ci / clang19 (C++17, Debug) (push) Failing after 53s
ci / g++15 (C++17, Debug) (push) Failing after 50s
ci / clang20 (C++17, Release) (push) Failing after 52s
ci / g++15 (C++17, Release) (push) Failing after 51s
ci / asan (C++17, asan) (push) Failing after 50s

This commit is contained in:
2025-11-07 20:43:12 +10:30
parent becc41a5f0
commit ce68860175
2 changed files with 160 additions and 0 deletions
+90
View File
@@ -0,0 +1,90 @@
name: Build & Push Docker image
on:
# Trigger on pushes to main or release branches, and on manual workflow dispatch
push:
branches:
- main
- 'release/**'
- 'beta/**'
workflow_dispatch:
jobs:
build-and-push:
runs-on: ubuntu-latest
environment: production
steps:
# ------------------------------------------------------------------
# 1. Checkout repository
# ------------------------------------------------------------------
- name: Checkout source
uses: actions/checkout@v4
with:
fetch-depth: 0 # needed for git revparse and tag generation
# ------------------------------------------------------------------
# 2. Set up Docker Buildx (optional, but recommended for multiarch)
# ------------------------------------------------------------------
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
# ------------------------------------------------------------------
# 3. Log in to the Gitea container registry
# ------------------------------------------------------------------
- name: Log in to Gitea registry
uses: docker/login-action@v3
with:
registry: ${{ secrets.REGISTRY_HOST }} # e.g. registry.example.com
username: ${{ secrets.REGISTRY_USER }} # e.g. admin
password: ${{ secrets.REGISTRY_PASSWORD }} # e.g. <apitoken>
# ------------------------------------------------------------------
# 4. Build the Docker image
# ------------------------------------------------------------------
- name: Build image
id: build
uses: docker/build-push-action@v5
with:
context: .
file: Dockerfile
# do not push yet
push: false
tags: |
${{ secrets.REGISTRY_HOST }}/${{ github.repository }}:${{ github.sha }}
${{ secrets.REGISTRY_HOST }}/${{ github.repository }}:${{ github.ref_name }}
${{ secrets.REGISTRY_HOST }}/${{ github.repository }}:latest
build-args: |
# Add any build args here
# ARG_NAME=VALUE
# ------------------------------------------------------------------
# 5. Push the image to the registry
# ------------------------------------------------------------------
- name: Push image
uses: docker/build-push-action@v5
with:
context: .
file: Dockerfile
push: true
tags: |
${{ secrets.REGISTRY_HOST }}/${{ github.repository }}:${{ github.sha }}
${{ secrets.REGISTRY_HOST }}/${{ github.repository }}:${{ github.ref_name }}
${{ secrets.REGISTRY_HOST }}/${{ github.repository }}:latest
# ------------------------------------------------------------------
# 6. (Optional) Clean up local Docker cache
# ------------------------------------------------------------------
- name: Docker system prune
run: docker system prune -f
if: ${{ always() }}
# ------------------------------------------------------------------
# 7. Output useful info
# ------------------------------------------------------------------
- name: Show pushed image tags
run: |
echo "Pushed image tags:"
echo "- ${{ secrets.REGISTRY_HOST }}/${{ github.repository }}:${{ github.sha }}"
echo "- ${{ secrets.REGISTRY_HOST }}/${{ github.repository }}:${{ github.ref_name }}"
echo "- ${{ secrets.REGISTRY_HOST }}/${{ github.repository }}:latest"