From 2c9b2d1e94dbe382fa73c99a44455022e07e7518 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elias=20H=C3=B6rner?= Date: Mon, 23 Jun 2025 16:04:25 +0200 Subject: [PATCH 1/7] [tmp changes] --- .github/workflows/build.yaml | 84 ++++++++++++++++++------------------ 1 file changed, 42 insertions(+), 42 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 1b012a0f..7edab64b 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -1,7 +1,7 @@ on: push: branches: - - release + - eliaspr/build-workflow-update jobs: container-image: @@ -9,50 +9,50 @@ jobs: runs-on: ubuntu-24.04 steps: - uses: actions/checkout@v2 - - name: 'Extract turnierplan.NET version' - shell: pwsh - run: | - $VersionXmlContent = Get-Content -Path "version.xml" -Raw - $Version = [regex]::Match($VersionXmlContent, '(\d+\.\d+\.\d+)').Groups[1].Value - Write-Host $Version - Add-Content -Path $env:GITHUB_ENV -Value "TURNIERPLAN_APPLICATION_VERSION=$Version" - working-directory: './src' - - name: 'Replace environment tokens' - uses: cschleiden/replace-tokens@v1 - with: - files: '["**/environment.prod.ts"]' - env: - TOKEN_APPLICATION_VERSION: "${{ env.TURNIERPLAN_APPLICATION_VERSION }}" - - name: Login to Docker Hub - uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1 - with: - username: ${{ secrets.DOCKER_HUB_USERNAME }} - password: ${{ secrets.DOCKER_HUB_PASSWORD }} - - name: 'Build and push container image' - uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4 - with: - context: ./src - file: ./src/Turnierplan.App/Dockerfile - push: true - tags: '${{ vars.DOCKER_HUB_REPOSITORY }}:latest,${{ vars.DOCKER_HUB_REPOSITORY }}:${{ env.TURNIERPLAN_APPLICATION_VERSION }}' + # - name: 'Extract turnierplan.NET version' + # shell: pwsh + # run: | + # $VersionXmlContent = Get-Content -Path "version.xml" -Raw + # $Version = [regex]::Match($VersionXmlContent, '(\d+\.\d+\.\d+)').Groups[1].Value + # Write-Host $Version + # Add-Content -Path $env:GITHUB_ENV -Value "TURNIERPLAN_APPLICATION_VERSION=$Version" + # working-directory: './src' + # - name: 'Replace environment tokens' + # uses: cschleiden/replace-tokens@v1 + # with: + # files: '["**/environment.prod.ts"]' + # env: + # TOKEN_APPLICATION_VERSION: "${{ env.TURNIERPLAN_APPLICATION_VERSION }}" + # - name: Login to Docker Hub + # uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1 + # with: + # username: ${{ secrets.DOCKER_HUB_USERNAME }} + # password: ${{ secrets.DOCKER_HUB_PASSWORD }} + # - name: 'Build and push container image' + # uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4 + # with: + # context: ./src + # file: ./src/Turnierplan.App/Dockerfile + # push: true + # tags: '${{ vars.DOCKER_HUB_REPOSITORY }}:latest,${{ vars.DOCKER_HUB_REPOSITORY }}:${{ env.TURNIERPLAN_APPLICATION_VERSION }}' nuget-package: name: 'Build NuGet package' runs-on: ubuntu-24.04 steps: - uses: actions/checkout@v2 - - name: 'Setup .NET SDK 9.x' - uses: actions/setup-dotnet@v3 - with: - dotnet-version: '9.x' - - name: 'Restore .NET solution' - run: 'dotnet restore' - working-directory: './src' - - name: 'Pack Turnierplan.Adapter' - run: 'dotnet pack Turnierplan.Adapter/Turnierplan.Adapter.csproj -c Release -o .' - working-directory: './src' - - name: 'Push to NuGet' - env: - NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }} - run: 'dotnet nuget push ./*.nupkg --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json --skip-duplicate' - working-directory: './src' + # - name: 'Setup .NET SDK 9.x' + # uses: actions/setup-dotnet@v3 + # with: + # dotnet-version: '9.x' + # - name: 'Restore .NET solution' + # run: 'dotnet restore' + # working-directory: './src' + # - name: 'Pack Turnierplan.Adapter' + # run: 'dotnet pack Turnierplan.Adapter/Turnierplan.Adapter.csproj -c Release -o .' + # working-directory: './src' + # - name: 'Push to NuGet' + # env: + # NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }} + # run: 'dotnet nuget push ./*.nupkg --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json --skip-duplicate' + # working-directory: './src' From d3209f4af782033072e1fc7625231cc0c3f104eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elias=20H=C3=B6rner?= Date: Mon, 23 Jun 2025 16:22:09 +0200 Subject: [PATCH 2/7] add --- .github/workflows/build.yaml | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 7edab64b..22cafd24 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -4,11 +4,40 @@ on: - eliaspr/build-workflow-update jobs: + validate-version: + name: 'Validate version' + runs-on: ubuntu-24.04 + steps: + - uses: actions/checkout@v2 + - name: 'Extract and validate 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, '(\d+\.\d+\.\d+)').Groups[1].Value + 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: + - validate-version steps: - uses: actions/checkout@v2 + - name: 'Test' + shell: pwsh + run: | + Write-Host ${{ needs.validate-version.outputs.turnierplan_version }} # - name: 'Extract turnierplan.NET version' # shell: pwsh # run: | @@ -39,6 +68,8 @@ jobs: nuget-package: name: 'Build NuGet package' runs-on: ubuntu-24.04 + needs: + - validate-version steps: - uses: actions/checkout@v2 # - name: 'Setup .NET SDK 9.x' From 7ad90c76214d6f42a087d4447018ddb0037ec09a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elias=20H=C3=B6rner?= Date: Mon, 23 Jun 2025 16:22:53 +0200 Subject: [PATCH 3/7] fetch-depth 0 --- .github/workflows/build.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 22cafd24..4057192b 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -9,6 +9,8 @@ jobs: runs-on: ubuntu-24.04 steps: - uses: actions/checkout@v2 + with: + fetch-depth: 0 - name: 'Extract and validate turnierplan.NET version' id: extract-version shell: pwsh From e4525d69717e823e808a79adaee526bb989345d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elias=20H=C3=B6rner?= Date: Mon, 23 Jun 2025 16:23:44 +0200 Subject: [PATCH 4/7] test --- src/version.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/version.xml b/src/version.xml index 4595f788..6d76aaf2 100644 --- a/src/version.xml +++ b/src/version.xml @@ -1,5 +1,5 @@ - 2025.2.0 + 2025.1.0 From c42116a0f2cc41cc93653394be720348c761834c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elias=20H=C3=B6rner?= Date: Mon, 23 Jun 2025 16:25:09 +0200 Subject: [PATCH 5/7] update --- .github/workflows/build.yaml | 84 ++++++++++++++++-------------------- 1 file changed, 36 insertions(+), 48 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 4057192b..0de8cad9 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -1,17 +1,17 @@ on: push: branches: - - eliaspr/build-workflow-update + - release jobs: validate-version: - name: 'Validate version' + name: 'Extract version' runs-on: ubuntu-24.04 steps: - uses: actions/checkout@v2 with: fetch-depth: 0 - - name: 'Extract and validate turnierplan.NET version' + - name: 'Extract turnierplan.NET version' id: extract-version shell: pwsh run: | @@ -36,36 +36,24 @@ jobs: - validate-version steps: - uses: actions/checkout@v2 - - name: 'Test' - shell: pwsh - run: | - Write-Host ${{ needs.validate-version.outputs.turnierplan_version }} - # - name: 'Extract turnierplan.NET version' - # shell: pwsh - # run: | - # $VersionXmlContent = Get-Content -Path "version.xml" -Raw - # $Version = [regex]::Match($VersionXmlContent, '(\d+\.\d+\.\d+)').Groups[1].Value - # Write-Host $Version - # Add-Content -Path $env:GITHUB_ENV -Value "TURNIERPLAN_APPLICATION_VERSION=$Version" - # working-directory: './src' - # - name: 'Replace environment tokens' - # uses: cschleiden/replace-tokens@v1 - # with: - # files: '["**/environment.prod.ts"]' - # env: - # TOKEN_APPLICATION_VERSION: "${{ env.TURNIERPLAN_APPLICATION_VERSION }}" - # - name: Login to Docker Hub - # uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1 - # with: - # username: ${{ secrets.DOCKER_HUB_USERNAME }} - # password: ${{ secrets.DOCKER_HUB_PASSWORD }} - # - name: 'Build and push container image' - # uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4 - # with: - # context: ./src - # file: ./src/Turnierplan.App/Dockerfile - # push: true - # tags: '${{ vars.DOCKER_HUB_REPOSITORY }}:latest,${{ vars.DOCKER_HUB_REPOSITORY }}:${{ env.TURNIERPLAN_APPLICATION_VERSION }}' + - name: 'Replace environment tokens' + uses: cschleiden/replace-tokens@v1 + with: + files: '["**/environment.prod.ts"]' + env: + TOKEN_APPLICATION_VERSION: "${{ needs.validate-version.outputs.turnierplan_version }}" + - name: Login to Docker Hub + uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1 + with: + username: ${{ secrets.DOCKER_HUB_USERNAME }} + password: ${{ secrets.DOCKER_HUB_PASSWORD }} + - name: 'Build and push container image' + uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4 + with: + context: ./src + file: ./src/Turnierplan.App/Dockerfile + push: true + tags: '${{ vars.DOCKER_HUB_REPOSITORY }}:latest,${{ vars.DOCKER_HUB_REPOSITORY }}:${{ needs.validate-version.outputs.turnierplan_version }}' nuget-package: name: 'Build NuGet package' @@ -74,18 +62,18 @@ jobs: - validate-version steps: - uses: actions/checkout@v2 - # - name: 'Setup .NET SDK 9.x' - # uses: actions/setup-dotnet@v3 - # with: - # dotnet-version: '9.x' - # - name: 'Restore .NET solution' - # run: 'dotnet restore' - # working-directory: './src' - # - name: 'Pack Turnierplan.Adapter' - # run: 'dotnet pack Turnierplan.Adapter/Turnierplan.Adapter.csproj -c Release -o .' - # working-directory: './src' - # - name: 'Push to NuGet' - # env: - # NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }} - # run: 'dotnet nuget push ./*.nupkg --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json --skip-duplicate' - # working-directory: './src' + - name: 'Setup .NET SDK 9.x' + uses: actions/setup-dotnet@v3 + with: + dotnet-version: '9.x' + - name: 'Restore .NET solution' + run: 'dotnet restore' + working-directory: './src' + - name: 'Pack Turnierplan.Adapter' + run: 'dotnet pack Turnierplan.Adapter/Turnierplan.Adapter.csproj -c Release -o .' + working-directory: './src' + - name: 'Push to NuGet' + env: + NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }} + run: 'dotnet nuget push ./*.nupkg --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json --skip-duplicate' + working-directory: './src' From 4c3e21125bce649eff386e14698c4ad7b5fab114 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elias=20H=C3=B6rner?= Date: Mon, 23 Jun 2025 16:25:38 +0200 Subject: [PATCH 6/7] revert --- src/version.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/version.xml b/src/version.xml index 6d76aaf2..4595f788 100644 --- a/src/version.xml +++ b/src/version.xml @@ -1,5 +1,5 @@ - 2025.1.0 + 2025.2.0 From c61b07c05070205b92619840fe40fd8f52378e96 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elias=20H=C3=B6rner?= Date: Mon, 23 Jun 2025 16:26:31 +0200 Subject: [PATCH 7/7] rename job --- .github/workflows/build.yaml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 0de8cad9..4fbfdee7 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -4,7 +4,7 @@ on: - release jobs: - validate-version: + extract-version: name: 'Extract version' runs-on: ubuntu-24.04 steps: @@ -33,7 +33,7 @@ jobs: name: 'Build container image' runs-on: ubuntu-24.04 needs: - - validate-version + - extract-version steps: - uses: actions/checkout@v2 - name: 'Replace environment tokens' @@ -41,7 +41,7 @@ jobs: with: files: '["**/environment.prod.ts"]' env: - TOKEN_APPLICATION_VERSION: "${{ needs.validate-version.outputs.turnierplan_version }}" + TOKEN_APPLICATION_VERSION: "${{ needs.extract-version.outputs.turnierplan_version }}" - name: Login to Docker Hub uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1 with: @@ -53,13 +53,13 @@ jobs: context: ./src file: ./src/Turnierplan.App/Dockerfile push: true - tags: '${{ vars.DOCKER_HUB_REPOSITORY }}:latest,${{ vars.DOCKER_HUB_REPOSITORY }}:${{ needs.validate-version.outputs.turnierplan_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: - - validate-version + - extract-version steps: - uses: actions/checkout@v2 - name: 'Setup .NET SDK 9.x'