Skip to content

Merge pull request #40 from samypr100/ci-integration #1

Merge pull request #40 from samypr100/ci-integration

Merge pull request #40 from samypr100/ci-integration #1

Workflow file for this run

name: Build and Deploy
on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
release:
types: [ "published" ]
permissions:
contents: write
packages: write
# cancel in progress jobs or runs for the current workflow
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/master' }}
jobs:
build-jar:
name: jar / ${{ matrix.os }} / ${{ matrix.jdk-version }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
jdk-version: [ 17 ]
os: [ ubuntu-latest, macos-latest, windows-latest ]
steps:
- uses: actions/checkout@v3
- name: Set Up JDK ${{ matrix.jdk-version }}
uses: actions/setup-java@v3
with:
java-version: ${{ matrix.jdk-version }}
distribution: 'temurin'
- name: Set Up Maven
uses: stCarolas/[email protected]
with:
maven-version: 3.8.8
- name: Cache Maven repository
uses: actions/cache@v3
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Import GPG Key
uses: crazy-max/ghaction-import-gpg@v5
with:
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
passphrase: ${{ secrets.GPG_PASSPHRASE }}
- name: Setup Maven Revision
shell: bash
run: echo "project_revision=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_ENV
- name: Update Maven Revision As Snapshot
if: github.event_name != 'release'
shell: bash
run: echo "project_revision=${{ env.project_revision }}-${GITHUB_SHA::6}-SNAPSHOT" >> $GITHUB_ENV
- name: Maven Build and Verify Jar
run: mvn -V -B -e -ff -ntp -P github,release-sign-artifacts -Drevision="${{ env.project_revision }}" clean verify
- name: Upload Artifacts
uses: actions/upload-artifact@v3
if: runner.os == 'Linux'
continue-on-error: true
with:
name: LitFX-${{ env.project_revision }}
path: |
./**/target/*.pom
./**/target/*.jar
./**/target/*.asc
retention-days: 10
if-no-files-found: error
- name: Deploy Github Package
if: runner.os == 'Linux' && (github.ref == 'refs/heads/master' || github.event_name == 'release')
continue-on-error: true
# LitFX is an invalid artifactId per GH Packages, using -fn to allow others to upload
run: mvn -V -B -e -fn -ntp -P github,release-sign-artifacts -Drevision="${{ env.project_revision }}" deploy
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Deploy OSSRH Package
if: runner.os == 'Linux' && (github.ref == 'refs/heads/master' || github.event_name == 'release')
run: mvn -V -B -e -ff -ntp -P ossrh,release-sign-artifacts -Drevision=${{ env.project_revision }} deploy
env:
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}