Skip to content

Ensure that releases are not deployed from this workflow. #473

Ensure that releases are not deployed from this workflow.

Ensure that releases are not deployed from this workflow. #473

Workflow file for this run

on:
push:
branches:
- main
- develop
pull_request:
types: [opened, synchronize, reopened]
branches:
- main
- develop
workflow_dispatch:
name: Build and Test Code
jobs:
build-artifacts:
name: Build and Test Java Artifacts
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write
steps:
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9
with:
token: ${{ github.token }}
submodules: recursive
# -------------------------
# Java JDK 11
- name: Set up JDK 11
uses: actions/setup-java@5ffc13f4174014e2d4d4572b3d74c3fa61aeb2c2
with:
java-version: 11
distribution: 'temurin'
cache: 'maven'
- name: Initialize CodeQL
if: github.event_name == 'push'
uses: github/codeql-action/init@46ed16ded91731b2df79a2893d3aea8e9f03b5c4
with:
languages: java
# -------------------------
# Maven Build
- name: Build and run tests (develop)
id: maven-build-develop
if: ((github.event_name == 'push' || github.event_name == 'workflow_dispatch') && github.ref_name == 'develop') || (github.event_name == 'pull_request' && github.base_ref == 'develop')
run: |
mvn -Preporting verify
- name: Build and run tests (main)
if: steps.maven-build-develop.conclusion == 'skipped'
run: |
mvn -Prelease -Preporting verify
- name: Perform CodeQL Analysis
if: github.event_name == 'push'
uses: github/codeql-action/analyze@46ed16ded91731b2df79a2893d3aea8e9f03b5c4
deploy-snapshot:
name: Deploy SNAPSHOT Release
if: (github.event_name == 'push' || github.event_name == 'workflow_dispatch') && github.ref_name == 'develop'
needs: build-artifacts
runs-on: ubuntu-latest
permissions:
actions: read
steps:
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9
with:
token: ${{ github.token }}
submodules: recursive
# -------------------------
# Java JDK 11
- name: Set up JDK 11
uses: actions/setup-java@5ffc13f4174014e2d4d4572b3d74c3fa61aeb2c2
with:
java-version: 11
distribution: 'temurin'
cache: 'maven'
server-id: ossrh # Value of the distributionManagement/repository/id field of the pom.xml
server-username: MAVEN_USERNAME # env variable for username in deploy
server-password: MAVEN_CENTRAL_TOKEN # env variable for token in deploy
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }} # Value of the GPG private key to import
gpg-passphrase: MAVEN_GPG_PASSPHRASE # env variable for GPG private key passphrase
# -------------------------
# Maven Site
# -------------------------
- name: Build Website
run: |
mvn -Preporting -Prelease package site site:stage
working-directory: ${{ env.REPO_PATH }}
# -------------------------
# Maven Deploy
# -------------------------
- name: Deploy Maven Artifact SNAPSHOTs
run: |
mvn -e -Pgpg -Preporting deploy -Dmaven.deploy.skip=releases
env:
MAVEN_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
MAVEN_CENTRAL_TOKEN: ${{ secrets.SONATYPE_PASSWORD }}
MAVEN_GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}