-
Notifications
You must be signed in to change notification settings - Fork 44
82 lines (74 loc) · 2.62 KB
/
maven-publish.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
# 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:
push:
branches:
- master
- develop
tags:
- 'v*'
jobs:
build:
strategy:
matrix:
include:
- { os: ubuntu-20.04, arch: "linux/amd64" }
runs-on: ${{ matrix.os }}
steps:
- name: Branch name and revision
id: branch_name
run: |
set -xeo pipefail
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
cat $GITHUB_ENV > github.env
- uses: actions/checkout@v3
with:
submodules: "recursive"
- name: Set up JDK 17 (Snapshot)
if: ${{ !startsWith(github.ref, 'refs/tags/v') }}
uses: actions/setup-java@v3
with:
java-version: 17
distribution: temurin
cache: 'maven'
server-id: mchv-snapshot-distribution
server-username: MAVEN_USERNAME
server-password: MAVEN_PASSWORD
- name: Build and deploy to Maven (Snapshot)
if: ${{ !startsWith(github.ref, 'refs/tags/v') }}
shell: bash
run: |
set -xeo pipefail
mvn -B -f bom/pom.xml -P "java8,java17" clean deploy
echo "Done."
env:
MAVEN_USERNAME: ${{ secrets.MCHV_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.MCHV_TOKEN }}
- name: Set up JDK 17 (Release)
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
uses: actions/setup-java@v3
with:
java-version: 17
distribution: temurin
cache: 'maven'
server-id: mchv-release-distribution
server-username: MAVEN_USERNAME
server-password: MAVEN_PASSWORD
- name: Build and deploy to Maven (Release)
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
shell: bash
run: |
set -xeo pipefail
echo "REVISION: $REVISION"
mvn -B -f bom/pom.xml -Drevision="${REVISION}" -P "java8,java17" clean deploy
echo "Done."
env:
MAVEN_USERNAME: ${{ secrets.MCHV_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.MCHV_TOKEN }}