-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
92 additions
and
0 deletions.
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,92 @@ | ||
name: Release | ||
on: | ||
release: | ||
types: [ published ] | ||
permissions: | ||
contents: write | ||
jobs: | ||
get-version: | ||
name: Get version | ||
runs-on: ubuntu-latest | ||
env: | ||
GIT_USER_NAME: ${{ vars.GIT_USER_NAME }} | ||
GIT_USER_EMAIL: ${{ vars.GIT_USER_EMAIL }} | ||
outputs: | ||
version: ${{ steps.get_version.outputs.version-without-v }} | ||
next-patch-version: ${{ steps.version.outputs.inc-patch }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
- uses: dhkatz/[email protected] | ||
id: get_version | ||
- uses: madhead/semver-utils@latest | ||
id: version | ||
with: | ||
version: ${{ steps.get_version.outputs.version-without-v }} | ||
release: | ||
name: Release to SONATYPE | ||
runs-on: ubuntu-latest | ||
needs: get-version | ||
env: | ||
GIT_USER_NAME: ${{ vars.GIT_USER_NAME }} | ||
GIT_USER_EMAIL: ${{ vars.GIT_USER_EMAIL }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
- uses: actions/setup-java@v4 | ||
with: | ||
java-version: 11 | ||
distribution: temurin | ||
- uses: micronaut-projects/github-actions/pre-release@master | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Setup Gradle | ||
uses: gradle/actions/setup-gradle@v4 | ||
- name: Debug | ||
run: | | ||
echo "NOT running on ACT: ${{ !env.ACT }}" | ||
- name: Publish to Sonatype OSSRH | ||
if: ${{ !env.ACT }} # prevent deploy using gh act | ||
env: | ||
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }} | ||
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }} | ||
SONATYPE_STAGING_PROFILE_ID: ${{ secrets.SONATYPE_STAGING_PROFILE_ID }} | ||
SIGN_ARMORED_KEY: ${{ secrets.SIGN_ARMORED_KEY }} | ||
SIGN_PASSWORD: ${{ secrets.SIGN_PASSWORD }} | ||
RELEASE_VERSION: ${{ needs.get-version.outputs.version }} | ||
run: | | ||
echo "Publishing Artifacts for ${RELEASE_VERSION}" | ||
(set -x; ./gradlew -Pversion="${RELEASE_VERSION}" publishToSonatype closeAndReleaseSonatypeStagingRepository --no-daemon) | ||
bump-snapshot-version: | ||
runs-on: ubuntu-latest | ||
needs: [ get-version, release ] | ||
env: | ||
GIT_USER_NAME: ${{ vars.GIT_USER_NAME }} | ||
GIT_USER_EMAIL: ${{ vars.GIT_USER_EMAIL }} | ||
NEXT_VERSION: ${{ needs.get-version.outputs.next-patch-version }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Get branch names. | ||
id: branch-names | ||
uses: tj-actions/branch-names@v8 | ||
- uses: actions/setup-java@v4 | ||
with: | ||
java-version: 11 | ||
distribution: temurin | ||
- name: Setup Gradle | ||
uses: gradle/actions/setup-gradle@v4 | ||
- name: Set version in gradle.properties | ||
run: | | ||
echo "Preparing next snapshot as ${NEXT_VERSION}" | ||
./gradlew snapshotVersion -Pversion="${NEXT_VERSION}" | ||
- uses: actions-js/push@master | ||
with: | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
author_name: ${{ vars.GIT_USER_NAME }} | ||
author_email: $${ vars.GIT_USER_EMAIL }} | ||
branch: ${{ steps.branch-names.outputs.default_branch }} | ||
message: Set project version to ${{ env.NEXT_VERSION }}-SNAPSHOT |