Skip to content

Commit a49bef9

Browse files
Update build-exe.yml
1 parent bdc6526 commit a49bef9

1 file changed

Lines changed: 46 additions & 27 deletions

File tree

.github/workflows/build-exe.yml

Lines changed: 46 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -51,33 +51,52 @@ jobs:
5151
- name: Get latest release and compute next version
5252
id: version
5353
run: |
54-
LATEST=$(curl -L -H "Accept: application/vnd.github+json" -H "Authorization: Bearer ${{ secrets.UPLOAD_TOKEN }}" -H "X-GitHub-Api-Version: 2022-11-28" https://api.github.com/repos/${{ github.repository }}/releases/latest | jq -r .tag_name)
55-
echo "Latest release tag: $LATEST"
56-
57-
if [[ "$LATEST" =~ ^v([0-9]+)\.([0-9]+)\.([0-9]+)$ ]]; then
58-
MAJOR="${BASH_REMATCH[1]}"
59-
MINOR="${BASH_REMATCH[2]}"
60-
PATCH="${BASH_REMATCH[3]}"
61-
else
62-
MAJOR=0; MINOR=0; PATCH=0
63-
fi
64-
65-
PATCH=$((PATCH + 1))
66-
if [ $PATCH -ge 10 ]; then
67-
PATCH=0
68-
MINOR=$((MINOR + 1))
69-
fi
70-
71-
if [ $MINOR -ge 10 ]; then
72-
MINOR=0
73-
MAJOR=$((MAJOR + 1))
74-
fi
75-
76-
VERSION="v${MAJOR}.${MINOR}.${PATCH}"
77-
NAME="CopperOS - ${VERSION}"
78-
echo "Next version: $VERSION"
79-
echo "tag_name=$VERSION" >> $GITHUB_OUTPUT
80-
echo "version_name=$NAME" >> $GITHUB_OUTPUT
54+
$headers = @{
55+
"Accept" = "application/vnd.github+json"
56+
"Authorization" = "Bearer ${{ secrets.UPLOAD_TOKEN }}"
57+
"X-GitHub-Api-Version" = "2022-11-28"
58+
}
59+
60+
try {
61+
$response = Invoke-RestMethod -Uri "https://api.github.com/repos/${{ github.repository }}/releases/latest" -Headers $headers
62+
$LATEST = $response.tag_name
63+
Write-Host "Latest release tag: $LATEST"
64+
65+
if ($LATEST -match '^v([0-9]+)\.([0-9]+)\.([0-9]+)$') {
66+
$MAJOR = [int]$Matches[1]
67+
$MINOR = [int]$Matches[2]
68+
$PATCH = [int]$Matches[3]
69+
} else {
70+
$MAJOR = 0
71+
$MINOR = 0
72+
$PATCH = 0
73+
}
74+
75+
# Increment version numbers
76+
$PATCH++
77+
if ($PATCH -ge 10) {
78+
$PATCH = 0
79+
$MINOR++
80+
}
81+
82+
if ($MINOR -ge 10) {
83+
$MINOR = 0
84+
$MAJOR++
85+
}
86+
87+
$VERSION = "v${MAJOR}.${MINOR}.${PATCH}"
88+
$NAME = "Transcribe - ${VERSION}"
89+
Write-Host "Next version: $VERSION"
90+
91+
# Set outputs using proper PowerShell syntax
92+
"tag_name=$VERSION" >> $env:GITHUB_OUTPUT
93+
"version_name=$NAME" >> $env:GITHUB_OUTPUT
94+
} catch {
95+
Write-Host "Error getting latest release: $_"
96+
# Fallback to v0.0.1 if no releases exist
97+
"tag_name=v0.0.1" >> $env:GITHUB_OUTPUT
98+
"version_name=CopperOS - v0.0.1" >> $env:GITHUB_OUTPUT
99+
}
81100

82101
- name: Set up Python ${{ env.PYTHON_VERSION }}
83102
uses: actions/setup-python@v5

0 commit comments

Comments
 (0)