22# - Checks for merged PRs since the last tag
33# - Creates a pre-release version if changes are detected
44# - Builds and packages the software
5- # - Creates GitHub release with artifacts and download counters
5+ # - Creates GitHub release with artifacts
66
77name : GitFlow | Nightly Builds
88
@@ -39,20 +39,15 @@ jobs:
3939 - name : Check for merged PRs since last tag
4040 id : check_prs
4141 shell : powershell
42- env :
43- GH_TOKEN : ${{ github.token }}
4442 run : |
45- # Get the latest release tag (any type) from GitHub API
46- $LATEST_TAG = (& gh api repos/${env:GITHUB_REPOSITORY}/tags --paginate | ConvertFrom-Json)[0].name
47- Write-Host "Latest release from GitHub: $LATEST_TAG"
48-
49- if (-not $LATEST_TAG) {
50- Write-Host "No tag found, fallback to first commit."
51- $LATEST_TAG = (git rev-list --max-parents=0 HEAD)
52- }
43+ # Get the latest release tag (any type)
44+ $LATEST_TAG = git tag -l --sort=-version:refname | Select-Object -First 1
45+ Write-Host "Latest release: $LATEST_TAG"
5346
5447 # Get all merged PRs since last tag (only merge commits from PRs)
5548 $MERGED_PRS = git log --merges --grep="Merge pull request" --pretty=format:"%h %s" "$LATEST_TAG..develop"
49+
50+ # Count merges
5651 $MERGE_COUNT = ($MERGED_PRS | Measure-Object).Count
5752
5853 if ($MERGE_COUNT -eq 0) {
@@ -61,16 +56,16 @@ jobs:
6156 }
6257 else {
6358 Write-Host "Merged PRs since last tag (develop):"
64- foreach ($pr in $MERGED_PRS) {
65- Write-Host "- $pr"
66- }
59+ Write-Host $MERGED_PRS
6760
6861 if ($MERGE_COUNT -eq 1 -and $MERGED_PRS -match "Merge pull request #\d+ from .*/release/") {
6962 Write-Host "Only change since last tag is a release PR merge. Skipping build."
7063 $BUILD_NEEDED = $false
7164 }
7265 else {
7366 $BUILD_NEEDED = $true
67+
68+ # Set release type for output (adapts to your previous logic if you need it)
7469 if ($LATEST_TAG -like "*-*") {
7570 $RELEASE_TYPE = "prerelease"
7671 } else {
@@ -163,19 +158,26 @@ jobs:
163158
164159 # Package ADMX policy templates
165160 echo "### Zip ADMX ###"
166- Compress-Archive -Path .\Sources\Policies\ADMX -DestinationPath .\WAU_ADMX.zip -Force
161+ $admxPath = ".\Sources\Policies\ADMX\WAU.admx"
162+ try {
163+ (Get-Content $admxPath -Raw -ErrorAction Stop) -match 'revision="([\d\.]+)"' | Out-Null
164+ $ADMXversion = $matches[1]
165+ $admxZip = "WAU_ADMX_$($ADMXversion).zip"
166+ }
167+ catch {
168+ Write-Host "Error getting WAU ADMX version!"
169+ $admxZip = "WAU_ADMX.zip"
170+ }
171+ Compress-Archive -Path .\Sources\Policies\ADMX -DestinationPath .\$admxZip -Force
167172 Get-Item .\*.zip
173+ echo "admx_zip_name=$admxZip" >> $env:GITHUB_OUTPUT
168174
169175 # Calculate ADMX package hash for verification
170176 echo "### Get ADMX zip SHA ###"
171- $ADMXSHA = (Get-FileHash .\WAU_ADMX.zip ).hash
172- echo " - WAU_ADMX.zip SHA256: $ADMXSHA"
177+ $ADMXSHA = (Get-FileHash .\$admxZip ).hash
178+ echo " - $admxZip SHA256: $ADMXSHA"
173179 echo "admx_sha=$ADMXSHA" >> $env:GITHUB_OUTPUT
174180
175- # Create installation counter file for tracking installs
176- echo "### Create install counter file ###"
177- echo "Install counter file." > WAU_InstallCounter
178-
179181 # Step 6: Create GitHub release with all artifacts
180182 - name : Create release
181183 uses : ncipollo/release-action@bcfe5470707e8832e12347755757cec0eb3c22af # v1.18.0
@@ -186,7 +188,7 @@ jobs:
186188 prerelease : true
187189 generateReleaseNotes : true
188190 name : ${{ steps.format_version.outputs.ReleaseName }}
189- artifacts : " WAU.msi,WAU_ADMX.zip,WAU_InstallCounter "
191+ artifacts : " WAU.msi,${{ steps.build_project.outputs.admx_zip_name }} "
190192 body : |
191193 ${{ steps.format_version.outputs.ReleaseBodyIntro }}
192194
@@ -196,6 +198,4 @@ jobs:
196198 |Files|Hash (SHA256)|Downloads|
197199 |---|---|---|
198200 |[WAU.msi](https://github.com/Romanitho/Winget-AutoUpdate/releases/download/v${{ steps.format_version.outputs.NextSemVer }}/WAU.msi) (x64)|`${{ steps.build_project.outputs.msi_sha }}`|<picture></picture>|
199- |[WAU_ADMX.zip](https://github.com/Romanitho/Winget-AutoUpdate/releases/download/v${{ steps.format_version.outputs.NextSemVer }}/WAU_ADMX.zip)|`${{ steps.build_project.outputs.admx_sha }}`|<picture></picture>|
200-
201- <picture></picture>
201+ |[${{ steps.build_project.outputs.admx_zip_name }}](https://github.com/Romanitho/Winget-AutoUpdate/releases/download/v${{ steps.format_version.outputs.NextSemVer }}/${{ steps.build_project.outputs.admx_zip_name }})|`${{ steps.build_project.outputs.admx_sha }}`|<picture></picture>|
0 commit comments