2020-12-29 23:38:50 +01:00
|
|
|
# This workflow will build a package using Maven and then publish it to GitHub packages when a release is created
|
|
|
|
# For more information see: https://github.com/actions/setup-java#apache-maven-with-a-settings-path
|
|
|
|
|
|
|
|
name: Maven Package
|
|
|
|
|
|
|
|
on:
|
2020-12-29 23:41:27 +01:00
|
|
|
push:
|
2023-05-11 01:14:09 +02:00
|
|
|
branches:
|
|
|
|
- master
|
|
|
|
- develop
|
|
|
|
tags:
|
|
|
|
- 'v*'
|
2020-12-29 23:38:50 +01:00
|
|
|
|
|
|
|
jobs:
|
|
|
|
build:
|
|
|
|
strategy:
|
|
|
|
matrix:
|
|
|
|
include:
|
2023-05-09 18:01:53 +02:00
|
|
|
- { os: ubuntu-20.04, arch: "linux/amd64" }
|
2020-12-29 23:38:50 +01:00
|
|
|
runs-on: ${{ matrix.os }}
|
|
|
|
steps:
|
2023-05-11 01:14:09 +02:00
|
|
|
- name: Branch name and revision
|
2021-07-28 11:40:47 +02:00
|
|
|
id: branch_name
|
|
|
|
run: |
|
2023-05-09 18:01:53 +02:00
|
|
|
set -xeo pipefail
|
2023-05-11 01:14:09 +02:00
|
|
|
|
|
|
|
export SOURCE_NAME="${GITHUB_REF#refs/*/}"
|
|
|
|
export SOURCE_BRANCH="${GITHUB_REF#refs/heads/}"
|
|
|
|
export SOURCE_TAG="${GITHUB_REF#refs/tags/}"
|
|
|
|
export SOURCE_TAG_VERSION="${GITHUB_REF#refs/tags/v}"
|
|
|
|
export REVISION="$SOURCE_TAG_VERSION"
|
|
|
|
|
|
|
|
echo "SOURCE_TAG_VERSION=$SOURCE_TAG_VERSION" >> $GITHUB_ENV
|
|
|
|
echo "REVISION=$REVISION" >> $GITHUB_ENV
|
|
|
|
|
2023-05-09 20:44:04 +02:00
|
|
|
cat $GITHUB_ENV > github.env
|
|
|
|
- uses: actions/checkout@v3
|
2020-12-29 23:38:50 +01:00
|
|
|
with:
|
|
|
|
submodules: "recursive"
|
2021-10-22 20:15:39 +02:00
|
|
|
- name: Set up JDK 17 (Snapshot)
|
|
|
|
if: ${{ !startsWith(github.ref, 'refs/tags/v') }}
|
2022-11-15 02:28:46 +01:00
|
|
|
uses: actions/setup-java@v3
|
2020-12-29 23:38:50 +01:00
|
|
|
with:
|
2021-09-27 19:36:07 +02:00
|
|
|
java-version: 17
|
2022-11-15 02:28:46 +01:00
|
|
|
distribution: temurin
|
|
|
|
cache: 'maven'
|
2021-10-22 20:15:39 +02:00
|
|
|
server-id: mchv-snapshot-distribution
|
2020-12-29 23:38:50 +01:00
|
|
|
server-username: MAVEN_USERNAME
|
|
|
|
server-password: MAVEN_PASSWORD
|
2023-05-09 18:01:53 +02:00
|
|
|
- name: Build and deploy to Maven (Snapshot)
|
2023-05-09 20:44:04 +02:00
|
|
|
if: ${{ !startsWith(github.ref, 'refs/tags/v') }}
|
2021-10-22 13:24:19 +02:00
|
|
|
shell: bash
|
|
|
|
run: |
|
2023-05-09 18:01:53 +02:00
|
|
|
set -xeo pipefail
|
2023-02-08 20:29:16 +01:00
|
|
|
|
2023-05-09 18:01:53 +02:00
|
|
|
mvn -B -f bom/pom.xml -P "java8,java17" clean deploy
|
|
|
|
echo "Done."
|
2021-10-22 20:15:39 +02:00
|
|
|
env:
|
|
|
|
MAVEN_USERNAME: ${{ secrets.MCHV_USERNAME }}
|
|
|
|
MAVEN_PASSWORD: ${{ secrets.MCHV_TOKEN }}
|
|
|
|
- name: Set up JDK 17 (Release)
|
|
|
|
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
|
2022-11-15 02:28:46 +01:00
|
|
|
uses: actions/setup-java@v3
|
2021-10-22 20:15:39 +02:00
|
|
|
with:
|
|
|
|
java-version: 17
|
2022-11-15 02:28:46 +01:00
|
|
|
distribution: temurin
|
|
|
|
cache: 'maven'
|
2021-10-22 20:15:39 +02:00
|
|
|
server-id: mchv-release-distribution
|
|
|
|
server-username: MAVEN_USERNAME
|
|
|
|
server-password: MAVEN_PASSWORD
|
2023-05-09 18:01:53 +02:00
|
|
|
- name: Build and deploy to Maven (Release)
|
2021-07-28 12:17:25 +02:00
|
|
|
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
|
2020-12-29 23:38:50 +01:00
|
|
|
shell: bash
|
|
|
|
run: |
|
2023-05-09 18:01:53 +02:00
|
|
|
set -xeo pipefail
|
2020-12-29 23:38:50 +01:00
|
|
|
echo "REVISION: $REVISION"
|
2023-05-09 18:01:53 +02:00
|
|
|
|
|
|
|
mvn -B -f bom/pom.xml -Drevision="${REVISION}" -P "java8,java17" clean deploy
|
|
|
|
echo "Done."
|
2020-12-29 23:38:50 +01:00
|
|
|
env:
|
|
|
|
MAVEN_USERNAME: ${{ secrets.MCHV_USERNAME }}
|
|
|
|
MAVEN_PASSWORD: ${{ secrets.MCHV_TOKEN }}
|