-
Notifications
You must be signed in to change notification settings - Fork 2
104 lines (100 loc) · 3.64 KB
/
build.yaml
File metadata and controls
104 lines (100 loc) · 3.64 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
on: workflow_dispatch
jobs:
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 "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-amd64:
name: 'Build container image (amd64)'
runs-on: ubuntu-24.04
permissions:
contents: read
packages: write
needs:
- extract-version
steps:
- uses: actions/checkout@v2
- name: Login to container registry
uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: 'Build and push container image'
uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4
with:
context: .
file: ./docker/turnierplan-amd64/Dockerfile
push: true
# Note: Always push "latest" even when building from a non-main branch. This is because currently, no patches are released for a non-latest minor release.
tags: 'ghcr.io/turnierplan-net/turnierplan:latest,ghcr.io/turnierplan-net/turnierplan:${{ 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 10.x'
uses: actions/setup-dotnet@v3
with:
dotnet-version: '10.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'
documentation:
name: 'Build and publish documentation'
runs-on: ubuntu-24.04
permissions:
contents: read
pages: write
id-token: write
steps:
- uses: actions/checkout@v5
- name: "Set up Python 3.x"
uses: actions/setup-python@v5
with:
python-version: "3.x"
- name: "Install requirements"
run: "python3 -m pip install -r requirements.txt"
working-directory: "docs"
- name: "Build documentation"
run: "zensical build --clean"
working-directory: "docs"
- name: "Setup Pages"
uses: actions/configure-pages@v5
- name: "Upload artifact"
uses: actions/upload-pages-artifact@v3
with:
path: "docs/site"
- name: "Deploy to GitHub Pages"
id: deployment
uses: actions/deploy-pages@v4