Files
CaddyManager/.github/workflows/ci.yaml
ebolo 4c271241d7
All checks were successful
Caddy Manager CI build / docker (push) Successful in 2m45s
ci: publish only the web application container
Disable container support for tests and bump the application version to
1.2.1.
2026-07-26 20:02:13 +07:00

49 lines
2.1 KiB
YAML

name: Caddy Manager CI build
run-name: ${{ github.actor }} is running CI pipeline
on:
push:
branches:
- main
jobs:
build:
name: Build and push container
permissions:
packages: write
env:
RUNNER_TOOL_CACHE: /toolcache
NUGET_PACKAGES: ${{ github.workspace }}/.nuget/packages
runs-on: ubuntu-latest
steps:
-
name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/checkout@v4
- uses: actions/setup-dotnet@v3
with:
dotnet-version: '10' # SDK Version to use.
dotnet-quality: 'ga'
cache: true
cache-dependency-path: '**/packages.lock.json'
- name: Restore dependencies
# Scoped to the web app so the test project is never restored or built here; it pulls in
# Contracts and Services through its project references. Tests run locally, not in this job.
run: dotnet restore CaddyManager/CaddyManager.csproj --locked-mode
- name: Application metadata
id: metadata
run: |
echo "COMMIT_HASH=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
echo "APP_VERSION=$(grep 'public static readonly string Version' CaddyManager/Configurations/Application/ApplicationInfo.cs | sed -E 's/.*"([^"]+)".*/\1/')" >> $GITHUB_OUTPUT
- name: Patch application info
run: |
sed -i "s/public static readonly string CommitHash = \"\[DEVELOPMENT\]\";/public static readonly string CommitHash = \"${{ steps.metadata.outputs.COMMIT_HASH }}\";/" CaddyManager/Configurations/Application/ApplicationInfo.cs
- name: Publish container
run: |
dotnet publish CaddyManager/CaddyManager.csproj \
--configuration Release --os linux-musl --arch x64 \
/t:PublishContainer -p ContainerRegistry=ghcr.io \
-p ContainerRepository=${{ github.repository }} -p:ContainerImageTags='"${{ steps.metadata.outputs.APP_VERSION }};latest"'