Skip to content

Commit 5ac49e6

Browse files
committed
Testing updating versions
1 parent ae21b0d commit 5ac49e6

File tree

1 file changed

+38
-11
lines changed

1 file changed

+38
-11
lines changed

.github/workflows/test.yml

Lines changed: 38 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@ on:
44
workflow_dispatch:
55

66

7-
7+
env:
8+
# Needed for GitHub CLI
9+
GITHUB_TOKEN: ${{ github.token }}
810

911
defaults:
1012
run:
@@ -16,16 +18,41 @@ jobs:
1618
name: Close Milestone
1719

1820
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
2122
- uses: actions/checkout@v4
2223

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
2453
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

Comments
 (0)