Skip to content
name: Publish package to the Maven Central Repository & Docker Hub
on:
release:
types: [created]
jobs:
release-github-tag:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
distribution: 'adopt'
java-version: '17'
server-id: ossrh
server-username: MAVEN_USERNAME
server-password: MAVEN_PASSWORD
- name: Build a project & run unit tests
run: mvn -B -ntp package
- name: Get the tag name
run: echo "TAG=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_ENV
- name: Set version from git tag
run: mvn -B -ntp versions:set -DgenerateBackupPoms=false -DnewVersion="$TAG"
- name: Add jar to Github Release
uses: svenstaro/upload-release-action@v2
continue-on-error: true
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: target/keycloak-username-password-attribute-authenticator-${{ env.TAG }}.jar
asset_name: keycloak-username-password-attribute-authenticator-${{ env.TAG }}.jar
tag: ${{ github.ref }}