Skip to content

fix: replace semantic release with snapshot workflows - #517

Merged
hsluoyz merged 1 commit into
apache:masterfrom
cooronx:fix_improve_snapshot_publish
Apr 25, 2026
Merged

fix: replace semantic release with snapshot workflows#517
hsluoyz merged 1 commit into
apache:masterfrom
cooronx:fix_improve_snapshot_publish

Conversation

@cooronx

@cooronx cooronx commented Apr 25, 2026

Copy link
Copy Markdown
Contributor

After a PR is merged into master:

  • The build workflow runs Maven tests and coverage.
  • If build succeeds, the Maven snapshot workflow runs.
  • It finds the latest formal tag, for example v1.99.0.
  • It computes the next minor snapshot version, for example 1.100.0-SNAPSHOT.
  • It deploys that artifact to the Sonatype snapshot repository (maven).
  • The source snapshot workflow also runs after build succeeds.
  • It creates a GitHub prerelease like v1.100.0-snapshot.1, v1.100.0-snapshot.2, etc.
  • Snapshot release notes are incremental from the previous snapshot tag.

@cooronx
cooronx force-pushed the fix_improve_snapshot_publish branch from fd40b3a to 95e0ddf Compare April 25, 2026 07:51
@hsluoyz
hsluoyz requested a review from Copilot April 25, 2026 08:56

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR replaces the previous semantic-release-based automation with GitHub Actions workflows that publish Maven snapshots and generate GitHub source snapshot prereleases/draft releases after successful builds on master.

Changes:

  • Update Maven snapshot publishing configuration (snapshot repository URL + central publishing plugin version).
  • Remove semantic-release (Node-based) steps from CI.
  • Add new workflows to publish Maven snapshots and generate GitHub source snapshot prereleases / source release drafts.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
pom.xml Points snapshot deployments at Sonatype snapshot repo and bumps central publishing plugin.
.github/workflows/maven-ci.yml Removes semantic-release and related credentials from the CI workflow.
.github/workflows/maven-snapshot.yml Adds a post-build workflow that computes next snapshot version and deploys to Sonatype snapshots.
.github/workflows/source-snapshot.yml Adds a post-build workflow to create incremental GitHub prereleases with source archives and notes.
.github/workflows/source-release-draft.yml Adds a tag-triggered workflow to create draft GitHub releases with source archives and notes.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.


jobs:
publish-maven-snapshot:
if: ${{ github.repository == 'apache/casbin-jcasbin' && (github.event_name == 'workflow_dispatch' || github.event.workflow_run.conclusion == 'success') }}

Copilot AI Apr 25, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

workflow_dispatch can be run from any branch/ref, but the job if: currently allows publishing a snapshot whenever the workflow is manually dispatched. That makes it easy to accidentally deploy snapshots built from non-master code. Consider tightening the condition to only allow workflow_dispatch when github.ref == 'refs/heads/master' (or otherwise enforce the intended ref).

Suggested change
if: ${{ github.repository == 'apache/casbin-jcasbin' && (github.event_name == 'workflow_dispatch' || github.event.workflow_run.conclusion == 'success') }}
if: ${{ github.repository == 'apache/casbin-jcasbin' && ((github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/master') || github.event.workflow_run.conclusion == 'success') }}

Copilot uses AI. Check for mistakes.

jobs:
build-source-snapshot:
if: ${{ github.repository == 'apache/casbin-jcasbin' && (github.event_name == 'workflow_dispatch' || github.event.workflow_run.conclusion == 'success') }}

Copilot AI Apr 25, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

workflow_dispatch can be run from any branch/ref, but the job if: currently allows creating snapshot tags/releases whenever the workflow is manually dispatched. This can create prereleases from non-master code and pollute the tag namespace. Consider restricting manual dispatch to master (e.g., by adding a github.ref guard in the job if:).

Suggested change
if: ${{ github.repository == 'apache/casbin-jcasbin' && (github.event_name == 'workflow_dispatch' || github.event.workflow_run.conclusion == 'success') }}
if: ${{ github.repository == 'apache/casbin-jcasbin' && ((github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/master') || github.event.workflow_run.conclusion == 'success') }}

Copilot uses AI. Check for mistakes.
Comment on lines +16 to +19
jobs:
build-source-snapshot:
if: ${{ github.repository == 'apache/casbin-jcasbin' && (github.event_name == 'workflow_dispatch' || github.event.workflow_run.conclusion == 'success') }}
runs-on: ubuntu-latest

Copilot AI Apr 25, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Snapshot numbering is derived from existing tags (LAST_SNAPSHOT_NUMBER + 1). If multiple runs execute concurrently (e.g., several merges close together), they can compute the same next number and then race to create the same tag, causing one run to fail. Consider adding a concurrency group (and optionally cancel-in-progress: false) to serialize snapshot-release creation on master.

Copilot uses AI. Check for mistakes.
Comment on lines +83 to +85
FEATURES="$(git log --pretty=format:'%s (%h)' "${RANGE}" | grep -Ei '^(feat)(\(.+\))?: ' || true)"
FIXES="$(git log --pretty=format:'%s (%h)' "${RANGE}" | grep -Ei '^(fix)(\(.+\))?: ' || true)"
DOCS="$(git log --pretty=format:'%s (%h)' "${RANGE}" | grep -Ei '^(docs?|doc)(\(.+\))?: ' || true)"

Copilot AI Apr 25, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The release-notes regexes don’t match Conventional Commits that include breaking-change markers (e.g. feat!: / fix(scope)!:). Since semantic-release previously relied on Conventional Commits, this will cause some commits to be omitted from snapshot notes. Consider updating the patterns to allow an optional ! before the colon.

Suggested change
FEATURES="$(git log --pretty=format:'%s (%h)' "${RANGE}" | grep -Ei '^(feat)(\(.+\))?: ' || true)"
FIXES="$(git log --pretty=format:'%s (%h)' "${RANGE}" | grep -Ei '^(fix)(\(.+\))?: ' || true)"
DOCS="$(git log --pretty=format:'%s (%h)' "${RANGE}" | grep -Ei '^(docs?|doc)(\(.+\))?: ' || true)"
FEATURES="$(git log --pretty=format:'%s (%h)' "${RANGE}" | grep -Ei '^(feat)(\(.+\))?!?: ' || true)"
FIXES="$(git log --pretty=format:'%s (%h)' "${RANGE}" | grep -Ei '^(fix)(\(.+\))?!?: ' || true)"
DOCS="$(git log --pretty=format:'%s (%h)' "${RANGE}" | grep -Ei '^(docs?|doc)(\(.+\))?!?: ' || true)"

Copilot uses AI. Check for mistakes.
Comment on lines +64 to +66
FEATURES="$(git log --pretty=format:'%s (%h)' "${RANGE}" | grep -Ei '^(feat)(\(.+\))?: ' || true)"
FIXES="$(git log --pretty=format:'%s (%h)' "${RANGE}" | grep -Ei '^(fix)(\(.+\))?: ' || true)"
DOCS="$(git log --pretty=format:'%s (%h)' "${RANGE}" | grep -Ei '^(docs?|doc)(\(.+\))?: ' || true)"

Copilot AI Apr 25, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The release-notes regexes don’t match Conventional Commits that include breaking-change markers (e.g. feat!: / fix(scope)!:), so those commits won’t appear in the drafted release notes. Consider updating the patterns to allow an optional ! before the colon.

Suggested change
FEATURES="$(git log --pretty=format:'%s (%h)' "${RANGE}" | grep -Ei '^(feat)(\(.+\))?: ' || true)"
FIXES="$(git log --pretty=format:'%s (%h)' "${RANGE}" | grep -Ei '^(fix)(\(.+\))?: ' || true)"
DOCS="$(git log --pretty=format:'%s (%h)' "${RANGE}" | grep -Ei '^(docs?|doc)(\(.+\))?: ' || true)"
FEATURES="$(git log --pretty=format:'%s (%h)' "${RANGE}" | grep -Ei '^(feat)(\(.+\))?!?: ' || true)"
FIXES="$(git log --pretty=format:'%s (%h)' "${RANGE}" | grep -Ei '^(fix)(\(.+\))?!?: ' || true)"
DOCS="$(git log --pretty=format:'%s (%h)' "${RANGE}" | grep -Ei '^(docs?|doc)(\(.+\))?!?: ' || true)"

Copilot uses AI. Check for mistakes.
@@ -22,11 +22,6 @@ jobs:
uses: actions/setup-java@v1

Copilot AI Apr 25, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

actions/setup-java@v1 is an older major. Consider upgrading to actions/setup-java@v4 (it supports Java 8) to avoid deprecations and pick up security fixes.

Suggested change
uses: actions/setup-java@v1
uses: actions/setup-java@v4

Copilot uses AI. Check for mistakes.
@@ -35,19 +30,3 @@ jobs:
uses: codecov/codecov-action@v1

Copilot AI Apr 25, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

codecov/codecov-action@v1 is an older major; consider upgrading to a currently supported major (and adjusting config if needed) to avoid deprecation/security issues.

Suggested change
uses: codecov/codecov-action@v1
uses: codecov/codecov-action@v4

Copilot uses AI. Check for mistakes.
@hsluoyz
hsluoyz merged commit 38b2b82 into apache:master Apr 25, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants