11name : Pre-Release WinUtil
22
3+ permissions :
4+ contents : write
5+ actions : read
6+
37on :
48 workflow_run :
5- workflows : ["Compile"] # Ensure Compile winget.ps1 is done
9+ workflows : ["Compile"]
610 types :
711 - completed
812 workflow_dispatch : # Manual trigger added
913
1014jobs :
1115 build-runspace :
1216 runs-on : windows-latest
13- outputs :
14- version : ${{ steps.extract_version.outputs.version }}
1517 steps :
1618 - name : Checkout Repository
1719 uses : actions/checkout@v4
1820
1921 - name : Extract Version from winutil.ps1
2022 id : extract_version
2123 run : |
22- $version = ''
23- Get-Content ./winutil.ps1 -TotalCount 30 | ForEach-Object {
24- if ($_ -match 'Version\s*:\s*(\d{2}\.\d{2}\.\d{2})') {
25- $version = "pre"+$matches[1]
26- echo "version=$version" >> $GITHUB_ENV
27- echo "::set-output name=version::$version"
28- break
29- }
30- }
31- if (-not $version) {
32- Write-Error "Version not found in winutil.ps1"
33- exit 1
24+ $version = (Get-Date -Format "yy.MM.dd")
25+ echo "version=$version" >> $env:GITHUB_ENV
26+ shell : pwsh
27+
28+ - name : Create Tag
29+ id : create_tag
30+ run : |
31+ $tagExists = git tag -l $env:VERSION
32+ if ($tagExists -eq "") {
33+ git tag $env:VERSION
34+ git push origin $env:VERSION
35+ } else {
36+ Write-Host "Tag $env:VERSION already exists, skipping tag creation"
3437 }
3538 shell : pwsh
3639
3740 - name : Create and Upload Release
3841 id : create_release
3942 uses : softprops/action-gh-release@v2
4043 with :
41- tag_name : ${{ steps.extract_version.outputs.version }}
42- name : Pre-Release ${{ steps.extract_version.outputs.version }}
44+ tag_name : ${{ env.VERSION }}
45+ name : Pre-Release ${{ env.VERSION }}
46+ body : " "
47+ append_body : false
4348 files : ./winutil.ps1
4449 prerelease : true
50+ generate_release_notes : true
4551 env :
46- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
52+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
0 commit comments