55 branches : [main]
66
77jobs :
8+ get_version :
9+ runs-on : windows-latest
10+ outputs :
11+ build_num : ${{ steps.version.outputs.build_num }}
12+ tag : ${{ steps.version.outputs.tag }}
13+
14+ permissions :
15+ contents : read
16+
17+ steps :
18+ - uses : actions/checkout@v4
19+ with :
20+ fetch-depth : 0
21+ fetch-tags : true
22+
23+ - name : Get version and label
24+ id : version
25+ run : |
26+ $version = (Select-String -Path CMakeLists.txt -Pattern 'project\(.*VERSION ([0-9\.]+)').Matches[0].Groups[1].Value
27+ $tag = git tag --sort=-taggerdate | Select-Object -Last 1
28+ if (-not $tag) { $build_num = 0 }
29+ else { $build_num = [int]($tag.Split('.')[-1]) }
30+ $next_build_num = $build_num + 1
31+ $full_version = "$version.$next_build_num"
32+ $new_tag_name = "v$full_version"
33+
34+ Write-Host "Latest tag: $tag"
35+ Write-Host "Build num: $build_num"
36+ Write-Host "Next build num: $next_build_num"
37+ Write-Host "Full version: $full_version"
38+ Write-Host "New tag: $new_tag_name"
39+
40+ echo "tag=$new_tag_name" | Out-File -FilePath $env:GITHUB_OUTPUT -Append
41+ echo "build_num=$next_build_num" | Out-File -FilePath $env:GITHUB_OUTPUT -Append
42+
843 build-librespot :
944 uses : ./.github/workflows/build-librespot.yml
1045 permissions :
1651 secrets : inherit
1752
1853 build-spotifar :
19- needs : build-librespot
54+ needs : [get_version, build-librespot]
2055 uses : ./.github/workflows/build-library.yml
2156 permissions :
2257 actions : read
@@ -26,37 +61,17 @@ jobs:
2661 build_librespot : false
2762 testing : false
2863 caching : false # no caching used for master releases
64+ build_num : ${{ needs.get_version.outputs.build_num }}
65+ version_tag : ${{ needs.get_version.outputs.tag }}
2966 secrets : inherit
3067
3168 packaging :
32- needs : [build-librespot, build-spotifar]
69+ needs : [get_version, build-librespot, build-spotifar]
3370 runs-on : windows-latest
3471 permissions :
3572 actions : read
3673 contents : write
3774 steps :
38- - uses : actions/checkout@v4
39- with :
40- fetch-depth : 0
41- fetch-tags : true
42-
43- - name : Get version and label
44- id : get_version
45- run : |
46- $version = (Select-String -Path CMakeLists.txt -Pattern 'project\(.*VERSION ([0-9\.]+)').Matches[0].Groups[1].Value
47- $tag = git tag --sort=-taggerdate
48- Write-Host "Tag: $tag"
49- if (-not $tag) { $build_num = 0 }
50- else { $build_num = [int]($tag.Split('.')[-1]) }
51- Write-Host "Build num: $build_num"
52- $next_build_num = $build_num + 1
53- Write-Host "Next build num: $next_build_num"
54- $full_version = "$version.$next_build_num"
55- Write-Host "Full version: $full_version"
56- $new_tag_name = "v$full_version"
57- Write-Host "Tag: $new_tag_name"
58- echo "tag=$new_tag_name" | Out-File -FilePath $env:GITHUB_OUTPUT -Append
59-
6075 - name : Download all artifacts
6176 uses : actions/download-artifact@v5
6277 with :
6681 - name : Create GitHub Release
6782 uses : softprops/action-gh-release@v2
6883 with :
69- tag_name : ${{ steps .get_version.outputs.tag }}
70- name : Spotifar ${{ steps .get_version.outputs.tag }}
84+ tag_name : ${{ needs .get_version.outputs.tag }}
85+ name : Spotifar ${{ needs .get_version.outputs.tag }}
7186 files : artifacts/**/*
7287 generate_release_notes : true
0 commit comments