11name : Release
2+ run-name : coding-time-tracker-${{ github.ref_name }}
23
34on :
45 push :
56 tags :
67 - " *.*.*"
78
9+ permissions :
10+ contents : write
11+
812jobs :
9- build :
10- name : Release
13+ release :
1114 runs-on : windows-2022
12-
13- permissions :
14- contents : read
15+ timeout-minutes : 20
1516
1617 steps :
17- - name : Checkout repository
18+ - name : Check out repository
1819 uses : actions/checkout@v6
20+ with :
21+ persist-credentials : false
1922
2023 - name : Install Qt
2124 uses : jurplel/install-qt-action@v4
@@ -24,72 +27,69 @@ jobs:
2427 arch : " win64_msvc2022_64"
2528 cache : true
2629
27- - name : Configure CMake
28- run : >
29- cmake
30- -S .
31- -B build
32- -G "Visual Studio 17 2022"
33- -A x64
30+ - name : Configure release build
31+ shell : pwsh
32+ run : |
33+ cmake -S . -B build `
34+ -G "Visual Studio 17 2022" `
35+ -A x64
3436
3537 - name : Build
36- run : cmake --build build --config Release --parallel
38+ shell : pwsh
39+ run : |
40+ cmake --build build `
41+ --config Release `
42+ --parallel
43+
44+ - name : Test
45+ shell : pwsh
46+ run : |
47+ ctest `
48+ --test-dir build `
49+ -C Release `
50+ --output-on-failure
3751
38- - name : Prepare distribution
52+ - name : Prepare release archive
3953 shell : pwsh
4054 run : |
41- New-Item -ItemType Directory -Path dist -Force | Out-Null
55+ $packageName = "coding-time-tracker-${{ github.ref_name }}-windows-x64"
56+ $packagePath = "dist\$packageName"
57+ $archivePath = "dist\$packageName.zip"
58+ $executablePath = "$packagePath\coding-time-tracker.exe"
59+
60+ New-Item `
61+ -ItemType Directory `
62+ -Path $packagePath `
63+ -Force |
64+ Out-Null
4265
4366 Copy-Item `
4467 "build\Release\coding-time-tracker.exe" `
45- "dist\coding-time-tracker.exe"
68+ $executablePath
4669
4770 windeployqt.exe `
4871 --release `
4972 --no-translations `
50- --dir dist `
51- "dist\coding-time-tracker.exe"
52-
53- - name : Create ZIP archive
54- shell : pwsh
55- run : |
56- $archive = "coding-time-tracker-${{ github.ref_name }}-windows-x64.zip"
73+ --dir $packagePath `
74+ $executablePath
5775
5876 Compress-Archive `
59- -Path "dist\*" `
60- -DestinationPath $archive `
77+ -LiteralPath $packagePath `
78+ -DestinationPath $archivePath `
6179 -Force
6280
63- - name : Upload release archive
64- uses : actions/upload-artifact@v7
65- with :
66- path : coding-time-tracker-${{ github.ref_name }}-windows-x64.zip
67- archive : false
68- retention-days : 1
69-
70- release :
71- name : Publish GitHub release
72- needs : build
73- runs-on : ubuntu-latest
74-
75- permissions :
76- actions : read
77- contents : write
78-
79- steps :
80- - name : Download release archive
81- uses : actions/download-artifact@v8
82- with :
83- name : coding-time-tracker-${{ github.ref_name }}-windows-x64.zip
84- path : release
85-
86- - name : Create GitHub release
81+ - name : Publish GitHub release
82+ shell : pwsh
8783 env :
8884 GH_TOKEN : ${{ github.token }}
8985 run : |
90- gh release create "${{ github.ref_name }}" \
91- "release/coding-time-tracker-${{ github.ref_name }}-windows-x64.zip" \
92- --repo "${{ github.repository }}" \
93- --verify-tag \
94- --generate-notes \
86+ $archiveName = "coding-time-tracker-${{ github.ref_name }}-windows-x64.zip"
87+ $archivePath = "dist\$archiveName"
88+
89+ gh release create "${{ github.ref_name }}" `
90+ $archivePath `
91+ --repo "${{ github.repository }}" `
92+ --verify-tag `
93+ --generate-notes `
94+ --title "${{ github.ref_name }}" `
9595 --latest
0 commit comments