Add rolling versions

This commit is contained in:
Maurus Decimus committed 2026-10-21 11:58:04 +02:00
1 parent 1b0ce53c17
commit 7988018fdd
3 files changed
+77 -3

No files matched your search

+64 -1
View File
@@ -3,7 +3,7 @@ name: Build and Release
on:
push:
tags:
- 'v*'
- 'v*.*.*'
permissions:
contents: write
@@ -11,6 +11,9 @@ permissions:
jobs:
build:
runs-on: ubuntu-latest
outputs:
major: ${{ steps.version.outputs.major }}
prerelease: ${{ steps.version.outputs.prerelease }}
steps:
- uses: actions/checkout@v6
@@ -20,6 +23,27 @@ jobs:
node-version: 22
cache: npm
- name: Read package version
id: version
run: |
version=$(node -p "require('./package.json').version")
echo "version=$version" >> "$GITHUB_OUTPUT"
echo "major=${version%%.*}" >> "$GITHUB_OUTPUT"
case "$version" in
*-*) echo "prerelease=true" >> "$GITHUB_OUTPUT" ;;
*) echo "prerelease=false" >> "$GITHUB_OUTPUT" ;;
esac
- name: Check tag matches package version
env:
TAG: ${{ github.ref_name }}
VERSION: ${{ steps.version.outputs.version }}
run: |
if [ "${TAG#v}" != "$VERSION" ]; then
echo "::error::Tag $TAG does not match package.json version $VERSION"
exit 1
fi
- run: npm ci
- run: npm run typecheck
@@ -58,6 +82,45 @@ jobs:
GH_TOKEN: ${{ github.token }}
run: gh release edit "${{ github.ref_name }}" --draft=false --latest --repo "${{ github.repository }}"
rolling:
name: Update rolling major release
needs: [build, publish]
if: needs.build.outputs.prerelease == 'false'
runs-on: ubuntu-latest
concurrency:
group: rolling-v${{ needs.build.outputs.major }}
cancel-in-progress: false
permissions:
contents: write
env:
GH_TOKEN: ${{ github.token }}
GH_REPO: ${{ github.repository }}
TAG: ${{ github.ref_name }}
ROLLING_TAG: v${{ needs.build.outputs.major }}
ASSET: webui.zip
steps:
- name: Download versioned asset
run: gh release download "$TAG" --pattern "$ASSET"
- name: Move rolling tag
run: |
if gh api "repos/$GH_REPO/git/ref/tags/$ROLLING_TAG" --silent 2>/dev/null; then
gh api -X PATCH "repos/$GH_REPO/git/refs/tags/$ROLLING_TAG" -f sha="$GITHUB_SHA" -F force=true --silent
else
gh api -X POST "repos/$GH_REPO/git/refs" -f ref="refs/tags/$ROLLING_TAG" -f sha="$GITHUB_SHA" --silent
fi
- name: Publish rolling release
run: |
title="Stalwart WebUI ${ROLLING_TAG#v}.x"
notes="Tracks the latest ${ROLLING_TAG#v}.x release."
if gh release view "$ROLLING_TAG" >/dev/null 2>&1; then
gh release edit "$ROLLING_TAG" --title "$title" --notes "$notes" --draft=false --prerelease=false --latest=false
gh release upload "$ROLLING_TAG" "$ASSET" --clobber
else
gh release create "$ROLLING_TAG" "$ASSET" --verify-tag --title "$title" --notes "$notes" --latest=false
fi
cleanup:
name: Cleanup failed release
needs: [build]
+3
View File
@@ -2,6 +2,9 @@
"name": "stalwart-webui",
"private": true,
"version": "2.0.0",
"stalwart": {
"minServerVersion": "1.0.0"
},
"description": "Stalwart WebUI",
"type": "module",
"scripts": {
+10 -2
View File
@@ -15,10 +15,18 @@ export default defineConfig({
babel({ presets: [reactCompilerPreset()] }),
tailwindcss(),
{
name: 'emit-version',
name: 'emit-app-manifest',
apply: 'build',
generateBundle() {
this.emitFile({ type: 'asset', fileName: 'VERSION', source: `${pkg.version}\n` })
this.emitFile({
type: 'asset',
fileName: 'stalwart-app.json',
source: JSON.stringify({
id: 'webui',
version: pkg.version,
minServerVersion: pkg.stalwart.minServerVersion,
}),
})
},
},
],