Skip to content

fix(gha): Do not publish PR #6

fix(gha): Do not publish PR

fix(gha): Do not publish PR #6

Workflow file for this run

name: Build
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Java and Maven - setup settings.xml
uses: actions/setup-java@v4
with:
java-version: 17
distribution: 'temurin'
server-id: github
cache: 'maven'
- name: Configure Git user
run: |
git config user.email "[email protected]"
git config user.name "GitHub Actions"
- name: Build and Test
run: |
./mvnw clean verify
- name: Get version
id: get-version
if: ${{ github.event.pull_request == null }}
run: |
VERSION=$( ./mvnw help:evaluate -Dexpression=project.version -q -DforceStdout )
FINAL_NAME=$( ./mvnw help:evaluate -Dexpression=project.build.finalName -q -DforceStdout )
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
echo "final-name=$FINAL_NAME" >> "$GITHUB_OUTPUT"
- name: Display version
id: display-version
if: ${{ github.event.pull_request == null }}
run: |
echo "version: ${{ steps.get-version.outputs.version }}"
echo "final_name: ${{ steps.get-version.outputs.final-name }}"
- name: Publish to Github Package
if: ${{ github.event.pull_request == null }}
run: ./mvnw --batch-mode deploy
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}