Skip to content

Commit 70cd575

Browse files
committed
fix: enhance release script to support beta tagging and update branch logic
1 parent c29fa61 commit 70cd575

2 files changed

Lines changed: 100 additions & 42 deletions

File tree

.github/workflows/build.yml

Lines changed: 41 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,11 @@
55
# - Builds TXZ package using Docker (Slackware)
66
# - Calculates MD5 for integrity verification
77
# - Creates GitHub releases with package attached
8-
# - Updates PLG file in dev branch
8+
# - Updates PLG file in the appropriate branch (main for stable, dev for beta)
99
#
1010
# Triggers:
11-
# - New tag matching date pattern: vYYYY.MM.DD[a-z]
11+
# - Stable release: tag like vYYYY.MM.DD or vYYYY.MM.DDa
12+
# - Beta release: tag like vYYYY.MM.DD-dev
1213
# - Manual workflow_dispatch for testing builds
1314

1415
name: Build & Release Plugin
@@ -20,7 +21,7 @@ on:
2021
workflow_dispatch:
2122
inputs:
2223
version:
23-
description: "Version to build (e.g., 2026.02.01) - leave empty for test build"
24+
description: "Version to build (e.g., 2026.02.01 or 2026.02.01-dev) - leave empty for test build"
2425
required: false
2526
default: ""
2627

@@ -112,10 +113,26 @@ jobs:
112113
if: startsWith(github.ref, 'refs/tags/v')
113114

114115
steps:
116+
- name: Determine release type
117+
id: release_type
118+
run: |
119+
VERSION="${{ needs.build.outputs.version }}"
120+
if [[ "$VERSION" == *"-dev"* ]]; then
121+
echo "is_beta=true" >> $GITHUB_OUTPUT
122+
echo "target_branch=dev" >> $GITHUB_OUTPUT
123+
echo "prerelease=true" >> $GITHUB_OUTPUT
124+
echo "Release type: BETA (dev branch)"
125+
else
126+
echo "is_beta=false" >> $GITHUB_OUTPUT
127+
echo "target_branch=main" >> $GITHUB_OUTPUT
128+
echo "prerelease=false" >> $GITHUB_OUTPUT
129+
echo "Release type: STABLE (main branch)"
130+
fi
131+
115132
- name: Checkout repository
116133
uses: actions/checkout@v4
117134
with:
118-
ref: main
135+
ref: ${{ steps.release_type.outputs.target_branch }}
119136
token: ${{ secrets.GITHUB_TOKEN }}
120137

121138
- name: Download artifacts
@@ -128,6 +145,8 @@ jobs:
128145
id: notes
129146
run: |
130147
VERSION="${{ needs.build.outputs.version }}"
148+
TARGET_BRANCH="${{ steps.release_type.outputs.target_branch }}"
149+
IS_BETA="${{ steps.release_type.outputs.is_beta }}"
131150
132151
# Read component versions from release_info
133152
if [[ -f artifacts/release_info ]]; then
@@ -136,15 +155,26 @@ jobs:
136155
COMPONENTS="Compose v${{ env.COMPOSE_VERSION }}"
137156
fi
138157
158+
# Set release title based on type
159+
if [[ "$IS_BETA" == "true" ]]; then
160+
TITLE="Compose Manager v${VERSION} (Beta)"
161+
INSTALL_NOTE="**Beta Release** - Install from the beta channel for testing."
162+
else
163+
TITLE="Compose Manager v${VERSION}"
164+
INSTALL_NOTE=""
165+
fi
166+
139167
# Create release body
140168
cat > release_body.md << EOF
141-
## Compose Manager v${VERSION}
169+
## ${TITLE}
170+
171+
${INSTALL_NOTE}
142172
143173
### Installation
144174
145175
**Via Plugin Manager:**
146176
\`\`\`
147-
https://raw.githubusercontent.com/${{ github.repository }}/main/${{ env.PLUGIN_NAME }}.plg
177+
https://raw.githubusercontent.com/${{ github.repository }}/${TARGET_BRANCH}/${{ env.PLUGIN_NAME }}.plg
148178
\`\`\`
149179
150180
### Package Details
@@ -157,20 +187,21 @@ jobs:
157187
- name: Create GitHub Release
158188
uses: softprops/action-gh-release@v2
159189
with:
160-
name: "Compose Manager v${{ needs.build.outputs.version }}"
190+
name: "Compose Manager v${{ needs.build.outputs.version }}${{ steps.release_type.outputs.is_beta == 'true' && ' (Beta)' || '' }}"
161191
body_path: release_body.md
162192
files: |
163193
artifacts/*.txz
164194
fail_on_unmatched_files: true
165195
draft: false
166-
prerelease: false
196+
prerelease: ${{ steps.release_type.outputs.prerelease == 'true' }}
167197
env:
168198
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
169199

170-
- name: Update PLG in main branch
200+
- name: Update PLG in target branch
171201
run: |
172202
VERSION="${{ needs.build.outputs.version }}"
173203
MD5="${{ needs.build.outputs.md5 }}"
204+
TARGET_BRANCH="${{ steps.release_type.outputs.target_branch }}"
174205
175206
# Configure git
176207
git config user.name "github-actions[bot]"
@@ -188,4 +219,4 @@ jobs:
188219
# Commit and push
189220
git add ${{ env.PLUGIN_NAME }}.plg
190221
git commit -m "Release v${VERSION}" || echo "No changes to commit"
191-
git push origin main
222+
git push origin ${TARGET_BRANCH}

release.ps1

Lines changed: 59 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -7,23 +7,29 @@
77
This script creates and pushes a version tag which triggers GitHub Actions
88
to build the package and create a release. Uses date-based versioning (YYYY.MM.DD).
99
10-
Multiple releases on the same day get suffixes: v2026.02.01, v2026.02.01a, v2026.02.01b
10+
Stable releases: v2026.02.01, v2026.02.01a, v2026.02.01b
11+
Beta releases: v2026.02.01-dev (use -Beta flag)
1112
1213
Automatically generates release notes from git commits and updates the PLG file.
1314
15+
.PARAMETER Beta
16+
Create a beta/dev release (adds -dev suffix, marks as prerelease on GitHub).
17+
1418
.PARAMETER DryRun
1519
Show what would be done without making any changes.
1620
1721
.PARAMETER Force
1822
Skip all confirmation prompts.
1923
2024
.EXAMPLE
21-
./release.ps1 # Creates v2026.02.01 (or next available)
25+
./release.ps1 # Creates v2026.02.01 (stable)
26+
./release.ps1 -Beta # Creates v2026.02.01-dev (beta)
2227
./release.ps1 -DryRun # Preview without changes
2328
./release.ps1 -Force # Skip confirmations
2429
#>
2530

2631
param(
32+
[switch]$Beta,
2733
[switch]$DryRun,
2834
[switch]$Force
2935
)
@@ -34,47 +40,62 @@ $PlgFile = "compose.manager.plg"
3440

3541
Write-Host ""
3642
Write-Host "========================================" -ForegroundColor Cyan
37-
Write-Host " Compose Manager Release Script" -ForegroundColor Cyan
43+
if ($Beta) {
44+
Write-Host " Compose Manager BETA Release" -ForegroundColor Yellow
45+
} else {
46+
Write-Host " Compose Manager Release Script" -ForegroundColor Cyan
47+
}
3848
Write-Host "========================================" -ForegroundColor Cyan
3949
Write-Host ""
4050

4151
# Get today's date in version format
4252
$dateVersion = Get-Date -Format "yyyy.MM.dd"
43-
$baseTag = "v$dateVersion"
44-
45-
# Fetch latest tags from remote
46-
Write-Host "Fetching latest from origin..." -ForegroundColor Yellow
47-
git fetch origin --tags
4853

49-
# Get existing tags for today
50-
$existingTags = git tag -l "$baseTag*" 2>$null | Sort-Object
51-
52-
if ($existingTags) {
53-
Write-Host "Existing tags for today:" -ForegroundColor Yellow
54-
$existingTags | ForEach-Object { Write-Host " $_" -ForegroundColor Gray }
54+
if ($Beta) {
55+
# Beta releases use -dev.HHMM suffix for uniqueness
56+
$timeStamp = Get-Date -Format "HHmm"
57+
$newTag = "v$dateVersion-dev.$timeStamp"
58+
59+
# No collision check needed - time-based tags are unique
60+
git fetch origin --tags
61+
} else {
62+
# Stable release logic
63+
$baseTag = "v$dateVersion"
64+
65+
# Fetch latest tags from remote
66+
Write-Host "Fetching latest from origin..." -ForegroundColor Yellow
67+
git fetch origin --tags
5568

56-
# Find the next suffix
57-
$lastTag = $existingTags | Select-Object -Last 1
69+
# Get existing tags for today (exclude -dev tags)
70+
$existingTags = git tag -l "$baseTag*" 2>$null | Where-Object { $_ -notmatch '-dev' } | Sort-Object
5871

59-
if ($lastTag -eq $baseTag) {
60-
# First release was without suffix, next is 'a'
61-
$newTag = "${baseTag}a"
62-
} elseif ($lastTag -match "^v\d{4}\.\d{2}\.\d{2}([a-z])$") {
63-
# Increment the suffix letter
64-
$lastSuffix = $matches[1]
65-
$nextSuffix = [char]([int][char]$lastSuffix + 1)
66-
if ($nextSuffix -gt 'z') {
67-
Write-Error "Too many releases today! (exceeded 'z' suffix)"
72+
if ($existingTags) {
73+
Write-Host "Existing tags for today:" -ForegroundColor Yellow
74+
$existingTags | ForEach-Object { Write-Host " $_" -ForegroundColor Gray }
75+
76+
# Find the next suffix
77+
$lastTag = $existingTags | Select-Object -Last 1
78+
79+
if ($lastTag -eq $baseTag) {
80+
# First release was without suffix, next is 'a'
81+
$newTag = "${baseTag}a"
82+
} elseif ($lastTag -match "^v\d{4}\.\d{2}\.\d{2}([a-z])$") {
83+
# Increment the suffix letter
84+
$lastSuffix = $matches[1]
85+
$nextSuffix = [char]([int][char]$lastSuffix + 1)
86+
if ($nextSuffix -gt 'z') {
87+
Write-Error "Too many releases today! (exceeded 'z' suffix)"
88+
exit 1
89+
}
90+
$newTag = "$baseTag$nextSuffix"
91+
} else {
92+
Write-Error "Unexpected tag format: $lastTag"
6893
exit 1
6994
}
70-
$newTag = "$baseTag$nextSuffix"
7195
} else {
72-
Write-Error "Unexpected tag format: $lastTag"
73-
exit 1
96+
# No releases today yet - use base tag without suffix
97+
$newTag = $baseTag
7498
}
75-
} else {
76-
# No releases today yet - use base tag without suffix
77-
$newTag = $baseTag
7899
}
79100

80101
# Get the last tag for generating changelog
@@ -83,7 +104,13 @@ $versionNumber = $newTag -replace '^v', ''
83104

84105
Write-Host ""
85106
Write-Host "New release tag: " -NoNewline
86-
Write-Host $newTag -ForegroundColor Green
107+
if ($Beta) {
108+
Write-Host $newTag -ForegroundColor Yellow
109+
Write-Host " Type: BETA (will update dev branch)" -ForegroundColor Yellow
110+
} else {
111+
Write-Host $newTag -ForegroundColor Green
112+
Write-Host " Type: STABLE (will update main branch)" -ForegroundColor Green
113+
}
87114
Write-Host ""
88115

89116
# Generate release notes from git commits

0 commit comments

Comments
 (0)