Repository navigation
82 lines (67 loc) · 2.08 KB
/
Copy pathbuild-war.yml
File metadata and controls
82 lines (67 loc) · 2.08 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
name: Build WAR
permissions:
contents: write
concurrency:
group: publish-hapi-war
cancel-in-progress: false
on:
push:
branches: [main]
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout source
uses: actions/checkout@v4
- name: Install Java 8
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: '8'
- name: Install Ant
run: sudo apt-get update && sudo apt-get install -y ant
- name: Install Tomcat 9
run: |
TOMCAT_VERSION=9.0.123
echo "Downloading Tomcat..."
curl -fL \
--connect-timeout 15 \
--max-time 90 \
--retry 2 \
"https://dlcdn.apache.org/tomcat/tomcat-9/v${TOMCAT_VERSION}/bin/apache-tomcat-${TOMCAT_VERSION}.tar.gz" \
-o tomcat.tar.gz
echo "Extracting Tomcat..."
mkdir -p "$HOME/tomcat"
tar -xzf tomcat.tar.gz -C "$HOME/tomcat" \
--strip-components=1
echo "Tomcat ready."
- name: Build WAR
working-directory: HapiServer
run: |
ant \
-Dplatforms.JDK_8__System_.home="$JAVA_HOME" \
-Dj2ee.server.home="$HOME/tomcat" \
dist
- name: Upload WAR
uses: actions/upload-artifact@v4
with:
name: web-application
path: HapiServer/dist/*.war
if-no-files-found: error
- name: Prepare release WAR
run: |
cp HapiServer/dist/*.war HapiServer.war
- name: Publish latest WAR
if: github.ref == 'refs/heads/main'
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
if gh release view latest >/dev/null 2>&1; then
gh release upload latest HapiServer.war --clobber
else
gh release create latest HapiServer.war \
--title "Latest HAPI Server Build" \
--notes "Automatically built from the main branch." \
--target "$GITHUB_SHA"
fi