From 00eb3e0199909c83bd1a1117685b4dc411eb15f7 Mon Sep 17 00:00:00 2001 From: bkellam Date: Thu, 18 Dec 2025 14:32:21 -0500 Subject: [PATCH] add automated release workflow --- .github/workflows/release-sourcebot.yml | 86 +++++++++++++++++++++++++ 1 file changed, 86 insertions(+) create mode 100644 .github/workflows/release-sourcebot.yml diff --git a/.github/workflows/release-sourcebot.yml b/.github/workflows/release-sourcebot.yml new file mode 100644 index 00000000..0e1319b0 --- /dev/null +++ b/.github/workflows/release-sourcebot.yml @@ -0,0 +1,86 @@ +name: Release Sourcebot + +on: + workflow_dispatch: + inputs: + version: + description: "Version to release (e.g., 4.10.5)" + required: true + type: string + +jobs: + release: + runs-on: ubuntu-latest + permissions: + contents: write + + steps: + - name: Validate version format + run: | + VERSION="${{ inputs.version }}" + if ! [[ "$VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+(-[a-zA-Z0-9._-]+)?(\+[a-zA-Z0-9._-]+)?$ ]]; then + echo "Error: Version must follow semantic versioning format (X.Y.Z)" + exit 1 + fi + + - name: Checkout repository + uses: actions/checkout@v4 + with: + ref: main + fetch-depth: 0 + + - name: Check if version already exists + run: | + VERSION="${{ inputs.version }}" + if grep -q "## \[$VERSION\]" CHANGELOG.md; then + echo "Error: Version $VERSION already exists in CHANGELOG.md" + exit 1 + fi + if git tag | grep -q "^v$VERSION$"; then + echo "Error: Tag v$VERSION already exists" + exit 1 + fi + + - name: Update CHANGELOG.md + run: | + VERSION="${{ inputs.version }}" + DATE=$(date +%Y-%m-%d) + + # Insert the new version header after the [Unreleased] line + sed -i "/## \[Unreleased\]/a\\ + \\ + ## [$VERSION] - $DATE" CHANGELOG.md + + echo "Updated CHANGELOG.md with version $VERSION" + cat CHANGELOG.md | head -n 15 + + - name: Configure git + run: | + git config user.name "github-actions[bot]" + git config user.email "github-actions[bot]@users.noreply.github.com" + + - name: Commit CHANGELOG + run: | + VERSION="${{ inputs.version }}" + git add CHANGELOG.md + git commit -m "Release v$VERSION" + + - name: Create annotated tag + run: | + VERSION="${{ inputs.version }}" + git tag -a "v$VERSION" -m "sourcebot v$VERSION" + + - name: Push changes + run: | + git push origin main + git push origin --tags + + - name: Create GitHub release + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + VERSION="${{ inputs.version }}" + gh release create "v$VERSION" \ + --verify-tag \ + --generate-notes \ + --latest