fix(ci): publish releases from main pushes (#2)
Build Bifrost / build (push) Failing after 28s

Co-authored-by: Arnaud Dartois <admin@tordais.cc>
This commit was merged in pull request #2.
This commit is contained in:
arnaud.dartois authored and Arnaud Dartois committed 2026-11-06 09:08:31 +01:00
1 parent 88a344efcb
commit 5e3a73ea42
5 files changed
+10 -15

No files matched your search

+1 -1
View File
@@ -8,7 +8,7 @@ description: Use when creating or changing CI workflows, artifact upload, releas
- Fetch complete history and tags before version calculation (`fetch-depth: 0` where supported).
- Pin actions to immutable commits or exact versions and document when a mirror is required; act_runner compatibility must be checked.
- Cache Maven dependencies without caching secrets. Never put tokens in command output.
- Gate release on push to the configured main branch, version script release-needed output, and a workflow-generated-commit guard. Do not rely only on `[skip ci]`.
- Gate release on pushes to the configured main branch and a workflow-generated-commit guard. For this repository, every main-branch merge creates a release; Conventional Commits choose the major/minor/patch bump and other types default to patch.
- Update changelog, commit, tag that commit, push commit and tag, then create Gitea release from the exact changelog section.
- Use repository secrets for API credentials; describe branch protection permissions required for the release identity.
- Avoid release loops by checking actor/commit marker and tag state.
@@ -5,7 +5,7 @@ description: Use when changing semantic version calculation, release automation,
# Release versioning and changelog
- Treat `vMAJOR.MINOR.PATCH` Git tags as the sole release version source.
- Parse commits since the latest reachable version tag: breaking change or `!` bumps major; `feat` bumps minor; `fix`, `perf`, and `refactor` bump patch; other types do not request release.
- Parse commits since the latest reachable version tag: breaking change or `!` bumps major; `feat` bumps minor; `fix`, `perf`, and `refactor` bump patch. For this repository every merge to `main` releases, so other commit types default to a patch bump.
- Use a valid plugin manifest version format; keep snapshot metadata out of release tags.
- Keep `CHANGELOG.md` in Keep a Changelog 1.1.0 structure, newest first, with only Added, Changed, Deprecated, Removed, Fixed, and Security categories.
- Never invent a user-facing changelog detail from an unclear commit. Allow maintainers to edit generated entries before release.
+3 -11
View File
@@ -5,7 +5,7 @@ on:
branches: ["**"]
tags: ["v*.*.*"]
pull_request:
types: [opened, synchronize, reopened, closed]
types: [opened, synchronize, reopened]
workflow_dispatch:
inputs:
revision:
@@ -15,7 +15,6 @@ on:
jobs:
build:
runs-on: ubuntu-latest
if: github.event_name != 'pull_request' || github.event.action != 'closed' || github.event.pull_request.merged == true
steps:
- name: Checkout full history and tags
uses: actions/checkout@v4.2.2
@@ -33,7 +32,6 @@ jobs:
revision=$(sh scripts/version.sh)
if [ -n "$REVISION_OVERRIDE" ]; then revision="$REVISION_OVERRIDE"; fi
echo "revision=$revision" >> "$GITHUB_OUTPUT"
echo "release_needed=$(sh scripts/version.sh --release-needed)" >> "$GITHUB_OUTPUT"
echo "release_version=$(sh scripts/version.sh --next-release)" >> "$GITHUB_OUTPUT"
env:
REVISION_OVERRIDE: ${{ github.event.inputs.revision }}
@@ -49,21 +47,15 @@ jobs:
run: |
sh scripts/render-readme.sh "$BUILD_REVISION"
sh ./mvnw -B -Drevision="$BUILD_REVISION" verify
- name: Upload plugin JAR
uses: actions/upload-artifact@v4.6.2
with:
name: sonar-bifrost-plugin-${{ steps.version.outputs.revision }}
path: target/sonar-bifrost-plugin-${{ steps.version.outputs.revision }}.jar
if-no-files-found: error
- name: Build release version
if: github.event_name == 'pull_request' && github.event.action == 'closed' && github.event.pull_request.merged == true && github.event.pull_request.base.ref == 'main'
if: github.event_name == 'push' && github.ref == 'refs/heads/main' && !contains(github.event.head_commit.message, 'chore(release):')
env:
RELEASE_VERSION: ${{ steps.version.outputs.release_version }}
run: |
sh scripts/render-readme.sh "$RELEASE_VERSION"
sh ./mvnw -B -Drevision="$RELEASE_VERSION" verify
- name: Create release commit, tag, and Gitea release
if: github.event_name == 'pull_request' && github.event.action == 'closed' && github.event.pull_request.merged == true && github.event.pull_request.base.ref == 'main'
if: github.event_name == 'push' && github.ref == 'refs/heads/main' && !contains(github.event.head_commit.message, 'chore(release):')
env:
GITEA_TOKEN: ${{ secrets.RELEASE_TOKEN }}
GITEA_REPOSITORY: ${{ github.repository }}
+2 -2
View File
@@ -112,9 +112,9 @@ Edit the `[Unreleased]` entries by hand before release when generated wording ne
## CI and releases
The Gitea Actions workflow checks out full history/tags, installs Java 17, calculates a version, validates changelog formatting on pull requests, runs Maven verification, and uploads the JAR. On a main-branch push, a release commit/tag and Gitea release are created when Conventional Commits request a bump.
The Gitea Actions workflow checks out full history/tags, installs Java 17, calculates a version, validates changelog formatting on pull requests, and runs Maven verification. A push to `main` (normally a merged PR) creates a changelog release commit, version tag, and Gitea release with the built JAR attached. Conventional Commit types select major, minor, or patch bumps; other commit types default to a patch so every merge produces a new release. The release commit is excluded from triggering another release.
Configure the repository secret `RELEASE_TOKEN`. The workflow derives the Gitea API and repository URLs from `github.server_url` and `github.repository`, so no `GITEA_*` repository variables are needed. The token needs repository write access to push the changelog commit/tag and create a release with an asset. For protected branches, allow this token identity to push the release commit to `main`, or use a dedicated release branch and adjust `GITEA_MAIN_BRANCH`. Actions use GitHub-hosted action sources (`actions/checkout`, `actions/setup-java`, `actions/upload-artifact`); an isolated act_runner may need those repositories mirrored or outbound GitHub access.
Configure the repository secret `RELEASE_TOKEN`. The workflow derives the Gitea API and repository URLs from `github.server_url` and `github.repository`, so no `GITEA_*` repository variables are needed. The token needs repository write access to push the changelog commit/tag and create a release with an asset. For protected branches, allow this token identity to push the release commit to `main`, or use a dedicated release branch and adjust `GITEA_MAIN_BRANCH`. Actions use GitHub-hosted sources (`actions/checkout`, `actions/setup-java`); an isolated act_runner may need those repositories mirrored or outbound GitHub access.
## Skills
+3
View File
@@ -45,6 +45,9 @@ case "$bump" in
2) minor=$((minor + 1)); patch=0 ;;
1) patch=$((patch + 1)) ;;
esac
if [ "${1:-}" = "--next-release" ] && [ "$bump" -eq 0 ]; then
patch=$((patch + 1))
fi
next="$major.$minor.$patch"
case "${1:-}" in