Skip to content

Publish releases

Publish releases #34

name: Publish releases
on: workflow_dispatch
permissions:
contents: write
packages: write
jobs:
publish-release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up JDK
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17'
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3
- name: Build
run: ./gradlew build dockerBuildImage
- name: Publish example docker images
run: ./gradlew dockerPushImage
env:
ORG_GRADLE_PROJECT_DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
ORG_GRADLE_PROJECT_DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Publish maven artifacts
run: ./gradlew publish
env:
ORG_GRADLE_PROJECT_SIGNINGKEY: ${{secrets.ORG_GRADLE_PROJECT_SIGNINGKEY}}
ORG_GRADLE_PROJECT_SIGNINGPASSWORD: ${{secrets.ORG_GRADLE_PROJECT_SIGNINGPASSWORD}}
ORG_GRADLE_PROJECT_MAVEN_URL: https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/
ORG_GRADLE_PROJECT_MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }}
ORG_GRADLE_PROJECT_MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }}
- name: Tag version
run: |
VERSION=$(./gradlew properties | grep "version:" | awk '{print $2}')
TAG="v$VERSION"
git tag "$TAG"
echo "Publishing tag"
git push origin "$TAG" || true # Do not fail, if the tag already exists