Skip to content

AUTHLIB-153: Adding GitHub token to publish to Maven #8

AUTHLIB-153: Adding GitHub token to publish to Maven

AUTHLIB-153: Adding GitHub token to publish to Maven #8

Workflow file for this run

---
name: build
on:
push:
branches:
- '**'
pull_request:
types:
- opened
- edited
workflow_dispatch:
jobs:
build-java-source:
name: build jar file
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Set up Java build environmant
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17'
cache: 'maven'
- name: Build with Maven
run: mvn package
# Extract version from pom.xml
- name: Get Version from POM
id: get-version
run: |
version=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)
echo "version=$version" >> $GITHUB_ENV
#Publish jar if `SNAPSHOT` is present in the version
- name: Publish SNAPSHOT JAR
if: contains(env.version, '-SNAPSHOT')
run: mvn deploy -DskipTests
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}