Inject git describe output into the assembly's InformationalVersion at build time via an MSBuild target (local dev) or Docker build arg (CI/Docker). Local builds use v1.0.2-21-g9e67c59-dirty; Docker builds take APP_VERSION as a build arg to avoid MSBuild property collision with VERSION. Co-authored-by: opencode <opencode@anomaly.co>
64 lines
2.0 KiB
YAML
64 lines
2.0 KiB
YAML
name: Build and Push Containers
|
|
|
|
on:
|
|
push:
|
|
tags:
|
|
- 'v*'
|
|
workflow_dispatch:
|
|
inputs:
|
|
version:
|
|
description: 'Version tag (e.g., v1.2.3)'
|
|
required: true
|
|
default: 'manual'
|
|
|
|
jobs:
|
|
build-and-push:
|
|
strategy:
|
|
matrix:
|
|
service: [Lactose, MilkStream]
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- uses: docker/setup-buildx-action@v3
|
|
|
|
- name: Log in to Gitea Container Registry
|
|
uses: docker/login-action@v3
|
|
with:
|
|
registry: git.r3d.codes
|
|
username: ${{ gitea.actor }}
|
|
password: ${{ secrets.REGISTRY_TOKEN }}
|
|
|
|
- name: Determine version tag
|
|
run: |
|
|
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
|
|
echo "VERSION=$(echo '${{ github.event.inputs.version }}' | sed 's|/|-|g')" >> $GITHUB_ENV
|
|
else
|
|
echo "VERSION=$(echo '${{ gitea.ref_name }}' | sed 's|/|-|g')" >> $GITHUB_ENV
|
|
fi
|
|
|
|
- name: Lowercase repository name
|
|
run: echo "REPO_LC=$(echo '${{ gitea.repository }}' | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV
|
|
|
|
- name: Lowercase service name
|
|
run: echo "SERVICE_LC=$(echo '${{ matrix.service }}' | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV
|
|
|
|
- name: Prepare build args for ${{ matrix.service }}
|
|
run: |
|
|
if [ "${{ matrix.service }}" = "Lactose" ]; then
|
|
echo "BUILD_ARGS=SixLaborsLicenseKey=${{ secrets.SIXLABORS_KEY }}" >> $GITHUB_ENV
|
|
else
|
|
echo "BUILD_ARGS=APP_VERSION=$VERSION" >> $GITHUB_ENV
|
|
fi
|
|
|
|
- name: Build and push ${{ matrix.service }}
|
|
uses: docker/build-push-action@v5
|
|
with:
|
|
context: .
|
|
file: ./${{ matrix.service }}/Dockerfile
|
|
push: true
|
|
tags: |
|
|
git.r3d.codes/${{ env.REPO_LC }}/${{ env.SERVICE_LC }}:${{ env.VERSION }}
|
|
git.r3d.codes/${{ env.REPO_LC }}/${{ env.SERVICE_LC }}:latest
|
|
build-args: ${{ env.BUILD_ARGS }}
|