-
Notifications
You must be signed in to change notification settings - Fork 25
113 lines (91 loc) · 3.64 KB
/
build.yml
File metadata and controls
113 lines (91 loc) · 3.64 KB
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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
name: Build and Release
on:
push:
branches:
- master
tags:
- 'hortonmachine-*' # any tag starting with v, e.g. v0.10.11
jobs:
# ---- SNAPSHOT BUILD ----
snapshot:
if: github.ref == 'refs/heads/master'
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17'
cache: 'maven'
server-id: ossrh
server-username: MAVEN_USERNAME
server-password: MAVEN_PASSWORD
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }}
gpg-passphrase: MAVEN_GPG_PASSPHRASE
- name: Run Tests
run: mvn -U clean verify
- name: Build and Deploy Snapshot
run: mvn -U deploy -DskipTests=true -P release -Dmaven.javadoc.skip=true -Dgpg.skip=false
env:
MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }}
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
MAVEN_GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
# ---- RELEASE BUNDLE ----
release-bundle:
if: startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17'
cache: 'maven'
- name: Resolve project version
id: ver
run: echo "VERSION=$(mvn -q -DforceStdout help:evaluate -Dexpression=project.version)" >> "$GITHUB_OUTPUT"
- name: Build project (skip tests + javadoc)
run: mvn -U clean install -DskipTests -Dmaven.javadoc.skip=true
- name: Populate libs from hm-apps deps
run: |
set -euxo pipefail
TMPLIBS=./extras/export/libs
mkdir -p "${TMPLIBS}"
# Copy hm-apps RUNTIME dependencies into extras/export/libs
mvn -q -pl :hm-apps -am dependency:copy-dependencies \
-DoutputDirectory="${TMPLIBS}" \
-DincludeScope=runtime \
-DexcludeClassifiers=sources,javadoc
# Add the app jar itself
cp ./apps/target/hm-apps-*.jar "${TMPLIBS}"
# (don’t ship sources in runtime bundle)
rm -f "${TMPLIBS}"/*-sources.jar || true
- name: Assemble tar.gz bundle
run: |
set -euxo pipefail
VERSION="${{ steps.ver.outputs.VERSION }}"
TMPLIBS="./extras/export/libs"
DEPLOY="./extras/deploy"
RELEASE_DIR="${DEPLOY}/hortonmachine_${VERSION}"
rm -rf "${TMPLIBS}" "${DEPLOY}/libs" "${RELEASE_DIR}" "${DEPLOY}/hortonmachine_${VERSION}.tar.gz"
mkdir -p "${RELEASE_DIR}"
cp ./apps/target/hm-apps-*.jar "${TMPLIBS}"
rm -f ${TMPLIBS}/junit*.jar || true
rm -f ${TMPLIBS}/log4j-*.jar || true
rm -f ${TMPLIBS}/*-sources.jar || true
mv "${TMPLIBS}" "${RELEASE_DIR}/libs"
cp -rv ${DEPLOY}/*.sh ${DEPLOY}/*.exe ${DEPLOY}/*.bat ${DEPLOY}/imgs ${DEPLOY}/natives ${DEPLOY}/quiet-logging.properties "${RELEASE_DIR}"
tar -C "${DEPLOY}" -zcvf "${DEPLOY}/hortonmachine_${VERSION}.tar.gz" "hortonmachine_${VERSION}"
- name: Upload bundle artifact
uses: actions/upload-artifact@v4
with:
name: hortonmachine-${{ steps.ver.outputs.VERSION }}-bundle
path: extras/deploy/hortonmachine_${{ steps.ver.outputs.VERSION }}.tar.gz
- name: Attach bundle to GitHub Release
uses: softprops/action-gh-release@v2
with:
files: extras/deploy/hortonmachine_${{ steps.ver.outputs.VERSION }}.tar.gz