Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 27 additions & 6 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,44 @@ on:
- release

jobs:
container-image:
name: 'Build container image'
extract-version:
name: 'Extract version'
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: 'Extract turnierplan.NET version'
id: extract-version
shell: pwsh
run: |
$LatestTag = git describe --tags --abbrev=0 --match=[0-9]*.[0-9]*.[0-9]*
$VersionXmlContent = Get-Content -Path "version.xml" -Raw
$Version = [regex]::Match($VersionXmlContent, '<Version>(\d+\.\d+\.\d+)</Version>').Groups[1].Value
Write-Host $Version
Add-Content -Path $env:GITHUB_ENV -Value "TURNIERPLAN_APPLICATION_VERSION=$Version"
Write-Host "Last git tag: $LatestTag"
Write-Host "Detected version: $Version"
if ($Version -eq $LatestTag) {
Write-Host "Version equals latest tag, failing workflow!"
exit 1
}
Add-Content -Path $env:GITHUB_OUTPUT -Value "turnierplan_version=$Version"
working-directory: './src'
outputs:
turnierplan_version: ${{ steps.extract-version.outputs.turnierplan_version }}

container-image:
name: 'Build container image'
runs-on: ubuntu-24.04
needs:
- extract-version
steps:
- uses: actions/checkout@v2
- name: 'Replace environment tokens'
uses: cschleiden/replace-tokens@v1
with:
files: '["**/environment.prod.ts"]'
env:
TOKEN_APPLICATION_VERSION: "${{ env.TURNIERPLAN_APPLICATION_VERSION }}"
TOKEN_APPLICATION_VERSION: "${{ needs.extract-version.outputs.turnierplan_version }}"
- name: Login to Docker Hub
uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1
with:
Expand All @@ -34,11 +53,13 @@ jobs:
context: ./src
file: ./src/Turnierplan.App/Dockerfile
push: true
tags: '${{ vars.DOCKER_HUB_REPOSITORY }}:latest,${{ vars.DOCKER_HUB_REPOSITORY }}:${{ env.TURNIERPLAN_APPLICATION_VERSION }}'
tags: '${{ vars.DOCKER_HUB_REPOSITORY }}:latest,${{ vars.DOCKER_HUB_REPOSITORY }}:${{ needs.extract-version.outputs.turnierplan_version }}'

nuget-package:
name: 'Build NuGet package'
runs-on: ubuntu-24.04
needs:
- extract-version
steps:
- uses: actions/checkout@v2
- name: 'Setup .NET SDK 9.x'
Expand Down
Loading