Skip to content

Commit 2f852b5

Browse files
joewizclaude
andcommitted
[ci] Add GitHub Actions CI and release workflows
CI workflow: builds XAR on push/PR using exist-core extracted from Docker image (workaround for stale published SNAPSHOT artifacts). Release workflow: creates GitHub release with XAR artifact on tag push. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 8afe7d1 commit 2f852b5

File tree

2 files changed

+119
-0
lines changed

2 files changed

+119
-0
lines changed

.github/workflows/ci.yml

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
jobs:
10+
build:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- uses: actions/checkout@v4
15+
16+
- name: Set up JDK 21
17+
uses: actions/setup-java@v4
18+
with:
19+
java-version: '21'
20+
distribution: 'zulu'
21+
22+
- name: Extract exist-core JARs from Docker image
23+
run: |
24+
# Pull the latest eXist-db Docker image and extract the uber JAR
25+
docker pull existdb/existdb:latest
26+
CONTAINER_ID=$(docker create existdb/existdb:latest)
27+
28+
# Extract exist-core JAR and install into local Maven repo
29+
docker cp "$CONTAINER_ID:/exist/lib/exist-core-7.0.0-SNAPSHOT.jar" exist-core.jar
30+
docker cp "$CONTAINER_ID:/exist/lib/exist-start-7.0.0-SNAPSHOT.jar" exist-start.jar
31+
32+
# Install into local Maven repo so the build can find them
33+
mvn install:install-file \
34+
-Dfile=exist-core.jar \
35+
-DgroupId=org.exist-db \
36+
-DartifactId=exist-core \
37+
-Dversion=7.0.0-SNAPSHOT \
38+
-Dpackaging=jar \
39+
-DgeneratePom=true
40+
41+
mvn install:install-file \
42+
-Dfile=exist-start.jar \
43+
-DgroupId=org.exist-db \
44+
-DartifactId=exist-start \
45+
-Dversion=7.0.0-SNAPSHOT \
46+
-Dpackaging=jar \
47+
-DgeneratePom=true
48+
49+
# Create a test-jar (empty placeholder for compilation)
50+
jar cf exist-core-tests.jar -C /dev/null . 2>/dev/null || touch exist-core-tests.jar
51+
mvn install:install-file \
52+
-Dfile=exist-core-tests.jar \
53+
-DgroupId=org.exist-db \
54+
-DartifactId=exist-core \
55+
-Dversion=7.0.0-SNAPSHOT \
56+
-Dpackaging=test-jar \
57+
-DgeneratePom=false \
58+
-Dclassifier=tests
59+
60+
docker rm "$CONTAINER_ID"
61+
62+
- name: Build XAR (compile + package, skip tests)
63+
run: mvn package -DskipTests
64+
65+
- name: Upload XAR artifact
66+
uses: actions/upload-artifact@v4
67+
with:
68+
name: exist-request-xar
69+
path: target/exist-request-*.xar

.github/workflows/release.yml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
8+
jobs:
9+
release:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- uses: actions/checkout@v4
14+
15+
- name: Set up JDK 21
16+
uses: actions/setup-java@v4
17+
with:
18+
java-version: '21'
19+
distribution: 'zulu'
20+
21+
- name: Extract exist-core JARs from Docker image
22+
run: |
23+
docker pull existdb/existdb:latest
24+
CONTAINER_ID=$(docker create existdb/existdb:latest)
25+
docker cp "$CONTAINER_ID:/exist/lib/exist-core-7.0.0-SNAPSHOT.jar" exist-core.jar
26+
docker cp "$CONTAINER_ID:/exist/lib/exist-start-7.0.0-SNAPSHOT.jar" exist-start.jar
27+
mvn install:install-file \
28+
-Dfile=exist-core.jar \
29+
-DgroupId=org.exist-db \
30+
-DartifactId=exist-core \
31+
-Dversion=7.0.0-SNAPSHOT \
32+
-Dpackaging=jar \
33+
-DgeneratePom=true
34+
mvn install:install-file \
35+
-Dfile=exist-start.jar \
36+
-DgroupId=org.exist-db \
37+
-DartifactId=exist-start \
38+
-Dversion=7.0.0-SNAPSHOT \
39+
-Dpackaging=jar \
40+
-DgeneratePom=true
41+
docker rm "$CONTAINER_ID"
42+
43+
- name: Build XAR
44+
run: mvn package -DskipTests
45+
46+
- name: Create GitHub Release
47+
uses: softprops/action-gh-release@v2
48+
with:
49+
files: target/exist-request-*.xar
50+
generate_release_notes: true

0 commit comments

Comments
 (0)