Merge pull request #36 from zecdev/release/0.0.5 #11
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: Publish package to the Maven Central Repository | |
on: | |
push: | |
tags: | |
- v*.*.* | |
jobs: | |
check_secrets: | |
environment: deployment | |
permissions: | |
contents: read | |
runs-on: ubuntu-latest | |
outputs: | |
has-secrets: ${{ steps.check_secrets.outputs.defined }} | |
steps: | |
- id: check_secrets | |
env: | |
JRELEASER_MAVENCENTRAL_USERNAME: ${{ secrets.JRELEASER_MAVENCENTRAL_USERNAME }} | |
JRELEASER_MAVENCENTRAL_PASSWORD: ${{ secrets.JRELEASER_MAVENCENTRAL_PASSWORD }} | |
JRELEASER_GPG_PASSPHRASE: ${{ secrets.JRELEASER_GPG_PASSPHRASE }} | |
JRELEASER_GPG_SECRET_KEY: ${{ secrets.JRELEASER_GPG_SECRET_KEY }} | |
JRELEASER_GPG_PUBLIC_KEY: ${{ secrets.JRELEASER_GPG_PUBLIC_KEY }} | |
JRELEASER_GITHUB_TOKEN: ${{ secrets.JRELEASER_GITHUB_TOKEN }} | |
if: "${{ env.JRELEASER_MAVENCENTRAL_USERNAME != '' && env.JRELEASER_MAVENCENTRAL_PASSWORD != '' && env.JRELEASER_GPG_SECRET_KEY != '' && env.JRELEASER_GPG_PASSPHRASE != '' && env.JRELEASER_GPG_PUBLIC_KEY != '' && env.JRELEASER_GITHUB_TOKEN != '' }}" | |
run: echo "defined=true" >> $GITHUB_OUTPUT | |
deploy_release: | |
if: needs.check_secrets.outputs.has-secrets == 'true' | |
needs: [ check_secrets ] | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
steps: | |
- name: Checkout | |
timeout-minutes: 1 | |
uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 | |
- name: Checkout | |
timeout-minutes: 1 | |
uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 | |
- name: Set up Java | |
uses: actions/setup-java@b36c23c0d998641eff861008f374ee103c25ac73 | |
timeout-minutes: 1 | |
with: | |
java-version: '21' | |
distribution: 'zulu' | |
- name: Set up Gradle | |
uses: gradle/gradle-build-action@ac2d340dc04d9e1113182899e983b5400c17cda1 | |
timeout-minutes: 10 | |
with: | |
gradle-home-cache-cleanup: true | |
- name: Run chmod to make gradlew executable | |
run: chmod +x ./gradlew | |
- name: Deploy to Maven Local | |
timeout-minutes: 25 | |
env: | |
ORG_GRADLE_PROJECT_IS_SNAPSHOT: false | |
ORG_GRADLE_PROJECT_NATIVE_TARGETS_ENABLED: false | |
JRELEASER_GPG_SECRET_KEY: ${{ secrets.JRELEASER_GPG_SECRET_KEY }} | |
run: | | |
./gradlew publish --no-parallel | |
- name: Publish package to maven central | |
env: | |
JRELEASER_MAVENCENTRAL_USERNAME: ${{ secrets.JRELEASER_MAVENCENTRAL_USERNAME }} | |
JRELEASER_MAVENCENTRAL_PASSWORD: ${{ secrets.JRELEASER_MAVENCENTRAL_PASSWORD }} | |
JRELEASER_GPG_PASSPHRASE: ${{ secrets.JRELEASER_GPG_PASSPHRASE }} | |
JRELEASER_GPG_SECRET_KEY: ${{ secrets.JRELEASER_GPG_SECRET_KEY }} | |
JRELEASER_GPG_PUBLIC_KEY: ${{ secrets.JRELEASER_GPG_PUBLIC_KEY }} | |
JRELEASER_GITHUB_TOKEN: ${{ secrets.JRELEASER_GITHUB_TOKEN }} | |
run: ./gradlew :lib:jreleaserRelease | |
- name: Set output (Extract tag) | |
id: vars | |
run: | | |
VERSION=${GITHUB_REF#refs/tags/} | |
echo "tag=${VERSION}" >> $GITHUB_OUTPUT | |
- name: Remove 'v' prefix if exists and set RELEASE_VERSION | |
id: release_version | |
run: | | |
VERSION=${{ steps.vars.outputs.tag }} | |
# Remove 'v' prefix if present | |
RELEASE_VERSION=${VERSION#v} | |
echo "RELEASE_VERSION=${RELEASE_VERSION}" >> $GITHUB_ENV | |
- name: Check output | |
run: | | |
echo "RELEASE_VERSION: $RELEASE_VERSION" | |
echo "From Output: ${{ steps.release_version.outputs.RELEASE_VERSION }}" | |
env: | |
RELEASE_VERSION: ${{ env.RELEASE_VERSION }} | |
- name: Upload Artifacts | |
if: ${{ always() }} | |
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 | |
timeout-minutes: 1 | |
with: | |
name: Release binaries ${{ env.RELEASE_VERSION }} | |
path: lib/build/jreleaser/deploy/mavenCentral/maven-central/zip321-lib-${{ env.RELEASE_VERSION }}-bundle.zip |