-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support tagging to automatically release version to Maven Central #3
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
name: Build and publish artifacts | ||
on: | ||
push: | ||
tags: | ||
# Run on all tags (but not branches); releases artifact to Maven Central | ||
# Note this is NOT REGEX - see https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions#filter-pattern-cheat-sheet | ||
- v[0-9]+.[0-9]+.[0-9]+ | ||
jobs: | ||
build-and-publish: | ||
runs-on: ubuntu-22.04 # LTS EoL Apr 2025 | ||
|
||
env: | ||
ORG_GRADLE_PROJECT_sonatypeUsername: ${{ secrets.SONATYPE_PUBLISH_USERNAME }} | ||
ORG_GRADLE_PROJECT_sonatypePassword: ${{ secrets.SONATYPE_PUBLISH_PASSWORD }} | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-java@v3 | ||
with: | ||
java-version: '8.x' | ||
java-package: jdk | ||
architecture: x64 | ||
distribution: temurin | ||
|
||
- uses: actions/cache@v3 | ||
with: | ||
path: ~/.gradle | ||
key: ${{ runner.OS }}-gradle-${{ hashFiles('**/build.gradle') }} | ||
restore-keys: | | ||
${{ runner.OS }}-gradle- | ||
${{ runner.OS }} | ||
|
||
- name: Install Dependencies | ||
run: | | ||
./gradlew dependencies | ||
|
||
- name: Show Versions | ||
run: | | ||
echo "java: $(java -version)" | ||
|
||
- name: Extract branch name | ||
shell: bash | ||
run: echo "BRANCH=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_ENV | ||
|
||
- name: Close/release Nexus staging repository | ||
run: ./gradlew closeAndReleaseRepository -PisTag="true" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#!/bin/bash | ||
|
||
BRANCH=$(git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/') | ||
if [ "$BRANCH" != "main" ]; then | ||
echo "Must be on main branch to tag" | ||
exit 1 | ||
fi | ||
|
||
# Extract the version from build.gradle, and use it as the tag: | ||
VERSION_RE="^.*baseVersion = '([0-9]+\.[0-9]+\.[0-9]+)'.*" | ||
VERSION_STRING="$(grep 'baseVersion =' build.gradle)" | ||
if [[ ${VERSION_STRING} =~ ${VERSION_RE} ]]; then | ||
VERSION=${BASH_REMATCH[1]} | ||
fi | ||
|
||
if [ -z "${VERSION}" ]; then | ||
echo "Invalid version found in [${VERSION_STRING}]" | ||
exit 1 | ||
fi | ||
|
||
TAG="v${VERSION}" | ||
HASH=$(git rev-parse HEAD) | ||
git tag -a -m "${HASH}" "${TAG}" | ||
git push origin "${TAG}" |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
8.x 👀
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, this is for maximum compatibility with downstream dependencies, some of which still support anything >= 8.