fix: replace semantic release with snapshot workflows - #517
Conversation
fd40b3a to
95e0ddf
Compare
There was a problem hiding this comment.
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') }} |
There was a problem hiding this comment.
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).
| 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') }} |
|
|
||
| jobs: | ||
| build-source-snapshot: | ||
| if: ${{ github.repository == 'apache/casbin-jcasbin' && (github.event_name == 'workflow_dispatch' || github.event.workflow_run.conclusion == 'success') }} |
There was a problem hiding this comment.
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:).
| 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') }} |
| 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 |
There was a problem hiding this comment.
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.
| 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)" |
There was a problem hiding this comment.
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.
| 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)" |
| 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)" |
There was a problem hiding this comment.
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.
| 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)" |
| @@ -22,11 +22,6 @@ jobs: | |||
| uses: actions/setup-java@v1 | |||
There was a problem hiding this comment.
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.
| uses: actions/setup-java@v1 | |
| uses: actions/setup-java@v4 |
| @@ -35,19 +30,3 @@ jobs: | |||
| uses: codecov/codecov-action@v1 | |||
There was a problem hiding this comment.
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.
| uses: codecov/codecov-action@v1 | |
| uses: codecov/codecov-action@v4 |
After a PR is merged into master: