split util #3
Workflow file for this run
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
name: Release | |
on: | |
push: | |
tags: | |
- "v*.*.*" | |
jobs: | |
release: | |
name: Create Release | |
runs-on: macos-latest | |
permissions: write-all | |
outputs: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
steps: | |
- name: Extract Version Name | |
id: extract_name | |
run: echo "name=$(echo ${GITHUB_REF##*/})" >>$GITHUB_OUTPUT | |
shell: bash | |
- name: Checkout to Push Branch | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.ref }} | |
fetch-depth: 0 | |
- name: Generate Changelog | |
id: changelog | |
uses: metcalfc/changelog-generator@v4.1.0 | |
with: | |
mytoken: ${{ secrets.GITHUB_TOKEN }} | |
- name: Create Release | |
id: create_release | |
uses: ncipollo/release-action@v1 | |
with: | |
name: Release ${{ steps.extract_name.outputs.name }} | |
body: ${{ steps.changelog.outputs.changelog }} | |
publish: | |
name: Publish Release | |
permissions: write-all | |
runs-on: macos-latest | |
needs: release | |
steps: | |
- name: Checkout to Push Branch | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.ref }} | |
fetch-depth: 0 | |
- name: Extract Version from Tag | |
uses: damienaicheh/extract-version-from-tag-action@v1.1.0 | |
- name: Gradle Wrapper Validation | |
uses: gradle/actions/wrapper-validation@v3 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: 17 | |
distribution: 'corretto' | |
- name: Setup Gradle | |
uses: gradle/actions/setup-gradle@v3 | |
with: | |
gradle-home-cache-cleanup: true | |
- name: Confirm Tag Version Matches Properties Version | |
shell: bash | |
run: | | |
PROPERTIES="$(./gradlew properties --console=plain -q)" | |
PROPERTIES_VERSION="$(echo "$PROPERTIES" | grep "^version:" | cut -f2- -d ' ')" | |
if [ "$TAG_VERSION" != "$PROPERTIES_VERSION" ]; then | |
echo "Error: TAG_VERSION ($TAG_VERSION) != PROPERTIES_VERSION ($PROPERTIES_VERSION)" | |
exit 1 | |
fi | |
env: | |
TAG_VERSION: ${{ env.MAJOR }}.${{ env.MINOR }}.${{ env.PATCH }} | |
- name: Publish to MavenCentral | |
run: ./gradlew publishAllPublicationsToSonatypeRepository | |
env: | |
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }} | |
OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }} | |
SIGNING_KEY_ID: ${{ secrets.SIGNING_KEY_ID }} | |
SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }} | |
SIGNING_KEY: ${{ secrets.SIGNING_KEY }} |