Skip to content

Commit 40c2fff

Browse files
authored
Merge pull request eXist-db#6429 from duncdrum/dp-build-prep
2 parents ad94445 + 2fc0afb commit 40c2fff

71 files changed

Lines changed: 842 additions & 260 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/actions/install-mvnd/action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ inputs:
44
version:
55
description: 'The version of the Maven Daemon to install'
66
required: true
7-
default: '1.0.3'
7+
default: '1.0.6'
88
file-version-suffix:
99
description: 'A suffix to append to the version of the download file of Maven Daemon to install'
1010
required: false

.github/actions/maven-github-settings/action.yml

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,43 @@
1-
# Creates Maven settings.xml with auth for the eXist-db org's GitHub Packages repos.
1+
# Creates Maven settings.xml with auth for the eXist-db org's GitHub Packages repos
2+
# and optionally for Sonatype Central Portal publishing.
23
# Required for resolving artifacts from maven.pkg.github.com/eXist-db/{exist, exist-xqts-runner, jackrabbit-webdav-jakarta}.
34
name: Maven GitHub Packages settings
4-
description: Create settings.xml with github, github-xqts-runner, and github-jackrabbit-webdav-jakarta servers
5+
description: Create settings.xml with GitHub Packages and (optionally) Sonatype Central Portal servers
56
inputs:
67
token:
78
description: 'GitHub token for package authentication'
89
required: true
10+
central-token-username:
11+
description: 'Sonatype Central Portal user token username (release jobs only)'
12+
required: false
13+
default: ''
14+
central-token-password:
15+
description: 'Sonatype Central Portal user token password (release jobs only)'
16+
required: false
17+
default: ''
918
runs:
1019
using: 'composite'
1120
steps:
1221
- name: Create Maven settings for GitHub Packages
1322
shell: bash
23+
env:
24+
CENTRAL_TOKEN_USERNAME: ${{ inputs.central-token-username }}
25+
CENTRAL_TOKEN_PASSWORD: ${{ inputs.central-token-password }}
1426
run: |
1527
mkdir -p ~/.m2
1628
OWNER=$(echo "${{ github.repository_owner }}" | tr '[:upper:]' '[:lower:]')
29+
30+
# Build optional Central Portal server block
31+
CENTRAL_SERVER=""
32+
if [ -n "$CENTRAL_TOKEN_USERNAME" ]; then
33+
CENTRAL_SERVER="
34+
<server>
35+
<id>central</id>
36+
<username>${CENTRAL_TOKEN_USERNAME}</username>
37+
<password>${CENTRAL_TOKEN_PASSWORD}</password>
38+
</server>"
39+
fi
40+
1741
cat > ~/.m2/settings.xml << EOF
1842
<settings xmlns="http://maven.apache.org/SETTINGS/1.2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.2.0 https://maven.apache.org/xsd/settings-1.2.0.xsd">
1943
<servers>
@@ -31,7 +55,7 @@ runs:
3155
<id>github-jackrabbit-webdav-jakarta</id>
3256
<username>${OWNER}</username>
3357
<password>${{ inputs.token }}</password>
34-
</server>
58+
</server>${CENTRAL_SERVER}
3559
</servers>
3660
</settings>
3761
EOF

.github/workflows/ci-container.yml

Lines changed: 38 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
name: Publish Container
22
on:
33
push:
4+
branches:
5+
- develop
6+
- master
7+
tags:
8+
- 'eXist-*'
49
pull_request:
510
schedule:
611
- cron: "0 6 * * *"
@@ -11,8 +16,13 @@ jobs:
1116
name: Test and Publish Container Images
1217
runs-on: ubuntu-latest
1318
timeout-minutes: 60
14-
# NOTE (DP): Publish on develop and master, test on PRs against these
15-
if: github.ref == 'refs/heads/develop' || github.ref == 'refs/heads/master' || github.base_ref == 'develop' || github.base_ref == 'master'
19+
# Publish on develop (latest) and eXist-* tags (versioned + release); test on PRs against these branches.
20+
if: >
21+
github.ref == 'refs/heads/develop' ||
22+
github.ref == 'refs/heads/master' ||
23+
startsWith(github.ref, 'refs/tags/eXist-') ||
24+
github.base_ref == 'develop' ||
25+
github.base_ref == 'master'
1626
steps:
1727
- uses: actions/checkout@v6
1828
with:
@@ -23,11 +33,11 @@ jobs:
2333
distribution: temurin
2434
java-version: '21'
2535
- name: Set up QEMU
26-
uses: docker/setup-qemu-action@v4
36+
uses: docker/setup-qemu-action@06116385d9baf250c9f4dcb4858b16962ea869c3 # v4
2737
with:
2838
platforms: linux/amd64,linux/arm64
2939
- name: Make buildkit default
30-
uses: docker/setup-buildx-action@v4
40+
uses: docker/setup-buildx-action@d7f5e7f509e45cec5c76c4d5afdd7de93d0b3df5 # v4
3141
id: buildx
3242
- uses: ./.github/actions/maven-cache
3343
- uses: ./.github/actions/maven-github-settings
@@ -43,7 +53,17 @@ jobs:
4353
timeout-minutes: 35
4454
env:
4555
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
46-
run: mvn -V -B --no-transfer-progress -q -Pdocker -DskipTests -Ddependency-check.skip=true -P !mac-dmg-on-unix,!installer,!concurrency-stress-tests,!micro-benchmarks,skip-build-dist-archives clean package
56+
run: |
57+
REVISION_ARG=""
58+
if [[ "${{ github.ref }}" == refs/tags/eXist-* ]]; then
59+
VERSION="${{ github.ref_name }}"
60+
REVISION_ARG="-Drevision=${VERSION#eXist-}"
61+
fi
62+
mvn -V -B --no-transfer-progress -q \
63+
-Pdocker,skip-build-dist-archives \
64+
-DskipTests -Ddependency-check.skip=true \
65+
$REVISION_ARG \
66+
clean package
4767
- name: Check local images
4868
run: docker image ls
4969
- name: Check license headers
@@ -73,8 +93,6 @@ jobs:
7393
name: exist-core-failed-log
7494
path: exist.log
7595

76-
# NOTE (DP): When on master push release, when on develop push latest: Version is included automatically
77-
# TODO (DP): Confirm that releases triggered from maven publish images with the non SNAPSHOT version
7896
- name: Publish latest images
7997
if: github.repository == 'eXist-db/exist' && github.ref == 'refs/heads/develop'
8098
env:
@@ -83,14 +101,24 @@ jobs:
83101
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
84102
run: mvn --no-transfer-progress -q -Ddocker.tag=latest -Ddocker.username=$DOCKER_USERNAME -Ddocker.password=$DOCKER_PASSWORD docker:build docker:push
85103
working-directory: ./exist-docker
86-
- name: Publish release images
87-
if: github.repository == 'eXist-db/exist' && github.ref == 'refs/heads/master'
104+
105+
- name: Publish versioned release images
106+
if: github.repository == 'eXist-db/exist' && startsWith(github.ref, 'refs/tags/eXist-')
88107
env:
89108
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
90109
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
91110
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
92-
run: mvn --no-transfer-progress -q -Ddocker.tag=release -Ddocker.username=$DOCKER_USERNAME -Ddocker.password=$DOCKER_PASSWORD docker:build docker:push
111+
run: |
112+
VERSION="${{ github.ref_name }}"
113+
VERSION="${VERSION#eXist-}"
114+
mvn --no-transfer-progress -q \
115+
-Drevision="$VERSION" \
116+
-Ddocker.tag=release \
117+
-Ddocker.username=$DOCKER_USERNAME \
118+
-Ddocker.password=$DOCKER_PASSWORD \
119+
docker:build docker:push
93120
working-directory: ./exist-docker
121+
94122
# NOTE (DP): This is for debugging, publishes an experimental image from inside PRs against develop
95123
# - name: Publish experimental images
96124
# if: github.base_ref == 'develop'
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
name: Prepare Release
2+
3+
# Replaces mvn release:prepare. Updates CITATION.cff, commits, creates the
4+
# annotated tag, and pushes — which then triggers ci-release.yml.
5+
#
6+
# Requires a fine-grained PAT (RELEASE_PAT) with contents:write on this repo.
7+
# GITHUB_TOKEN pushes do not trigger downstream tag workflows.
8+
9+
on:
10+
workflow_dispatch:
11+
inputs:
12+
version:
13+
description: 'Release version (e.g. 7.0.0)'
14+
required: true
15+
type: string
16+
17+
permissions:
18+
contents: write
19+
20+
jobs:
21+
prepare:
22+
name: Prepare eXist-${{ inputs.version }}
23+
runs-on: ubuntu-latest
24+
timeout-minutes: 15
25+
steps:
26+
- uses: actions/checkout@v6
27+
with:
28+
fetch-depth: 0
29+
# PAT required so the tag push triggers ci-release.yml.
30+
# GITHUB_TOKEN pushes are intentionally blocked from triggering workflows.
31+
token: ${{ secrets.RELEASE_PAT }}
32+
33+
- uses: actions/setup-java@v5
34+
with:
35+
distribution: temurin
36+
java-version: '21'
37+
38+
- uses: ./.github/actions/maven-cache
39+
40+
- uses: ./.github/actions/maven-github-settings
41+
with:
42+
token: ${{ secrets.GITHUB_TOKEN }}
43+
44+
- name: Update CITATION.cff
45+
run: |
46+
mvn -B --no-transfer-progress \
47+
-Pcitation-release-metadata \
48+
-DupdateCff=true \
49+
-Drevision=${{ inputs.version }} \
50+
validate
51+
52+
- name: Commit and tag
53+
run: |
54+
git config user.name "github-actions[bot]"
55+
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
56+
git add CITATION.cff
57+
# Only commit if CITATION.cff actually changed
58+
git diff --staged --quiet || \
59+
git commit -m "[release] Prepare eXist-${{ inputs.version }}"
60+
git tag -a "eXist-${{ inputs.version }}" \
61+
-m "eXist-db ${{ inputs.version }}"
62+
git push origin HEAD
63+
git push origin "eXist-${{ inputs.version }}"

0 commit comments

Comments
 (0)