4
4
workflow_dispatch :
5
5
6
6
7
-
7
+ env :
8
+ # Needed for GitHub CLI
9
+ GITHUB_TOKEN : ${{ github.token }}
8
10
9
11
defaults :
10
12
run :
@@ -16,16 +18,41 @@ jobs:
16
18
name : Close Milestone
17
19
18
20
steps :
19
- # Doing a checkout, until this issue is resolved.
20
- # https://github.com/valeriobelli/gh-milestone/issues/15
21
+ # Checkout is needed so that we can update the get_versions.yml file
21
22
- uses : actions/checkout@v4
22
23
23
- - name : Close Milestone
24
+ - name : Increment Version Numbers
25
+ run : |
26
+ function Update-Version {
27
+ param (
28
+ [string]$Prefix
29
+ )
30
+ $workflowPath = "./.github/workflows/get_versions.yml"
31
+ $workflowContent = Get-Content -Path $workflowPath
32
+
33
+ $versionPattern = '"(\d+\.\d+\.)(\d+)"'
34
+ $pattern = "$Prefix`: $versionPattern"
35
+ $match = $workflowContent -match $pattern
36
+
37
+ if ($match[0] -match $versionPattern) {
38
+ $newVersion = $Matches[1] + ([int]$Matches[2] + 1)
39
+ $workflowContent = $workflowContent -replace $pattern,"$Prefix`: `"$newVersion`""
40
+ Write-Host "$Prefix updated to $newVersion"
41
+ } else {
42
+ Write-Error "Failed to update $Prefix version"
43
+ }
44
+
45
+ Set-Content -Path $workflowPath -Value $workflowContent
46
+ }
47
+
48
+ Update-Version -Prefix "mdix-version"
49
+ Update-Version -Prefix "mdix-colors-version"
50
+ Update-Version -Prefix "mdix-mahapps-version"
51
+
52
+ - name : Push Changes
24
53
run : |
25
- gh extension install valeriobelli/gh-milestone
26
- Write-Host "Using extension version $(gh milestone --version)"
27
- $milestones = $(gh milestone list --json number,title) | ConvertFrom-Json
28
- $milestoneNumber = ($milestones | Where-Object { $_.title -eq "5.1.0" }).number
29
- gh milestone edit $milestoneNumber --state closed
30
- env :
31
- GITHUB_TOKEN : ${{ secrets.SA_PAT }}
54
+ git config --local user.email "github-actions[bot]@users.noreply.github.com"
55
+ git config --local user.name "github-actions[bot]"
56
+ git commit -m "[automated] Increment version numbers after release of ${{ inputs.milestone }}" --all
57
+ git remote set-url origin https://${{ github.token }}@github.com/${{ github.repository }}
58
+ git push
0 commit comments