Repository navigation
81 lines (79 loc) · 3 KB
/
Copy pathrelease.yml
File metadata and controls
81 lines (79 loc) · 3 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
# Copyright(c) 2026 Sven Trittler
#
# This program and the accompanying materials are made available under the
# terms of the Eclipse Public License v. 2.0 which is available at
# http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License
# v. 1.0 which is available at
# http://www.eclipse.org/org/documents/edl-v10.php.
#
# SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
name: Release to Maven Central
on:
push:
tags:
- '[0-9]+.[0-9]+.[0-9]+*'
permissions:
contents: read
concurrency:
group: release-${{ github.ref }}
cancel-in-progress: false
jobs:
build:
name: Build and verify universal artifacts
uses: ./.github/workflows/universal.yml
publish:
name: Publish release to Maven Central
if: github.event_name == 'push' && github.ref_type == 'tag'
needs: build
runs-on: ubuntu-24.04
timeout-minutes: 45
env:
MAVEN_ARGS: --settings "${{ github.workspace }}/.github/maven-settings.xml"
steps:
- uses: actions/checkout@v7
- uses: actions/setup-java@v6
with:
distribution: temurin
java-version: '17'
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }}
gpg-passphrase-env-var: MAVEN_GPG_PASSPHRASE
overwrite-settings: false
cache: maven
cache-dependency-path: |
pom.xml
maven/pom.xml
src/buildtools/pom.xml
.github/maven-settings.xml
# The Central publishing extension requires Maven 3.
- uses: stCarolas/setup-maven@d6af6abeda15e98926a57b5aa970a96bb37f97d1 # v5
with:
maven-version: '3.9.9'
- uses: actions/download-artifact@v8
with:
name: universal-java
path: release
- name: Sign and publish the verified universal artifacts
env:
RELEASE_TAG: ${{ github.ref_name }}
MAVEN_CENTRAL_USERNAME: ${{ secrets.CENTRAL_SONATYPE_TOKEN_USERNAME }}
MAVEN_CENTRAL_PASSWORD: ${{ secrets.CENTRAL_SONATYPE_TOKEN_PASSWORD }}
MAVEN_GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
GPG_KEY_ID: ${{ secrets.GPG_KEY_ID }}
shell: bash
run: |
for KEY in MAVEN_CENTRAL_USERNAME MAVEN_CENTRAL_PASSWORD GPG_KEY_ID MAVEN_GPG_PASSPHRASE; do
if [ -z "${!KEY}" ]; then echo "::error::Missing publishing environment variable: $KEY"; exit 1; fi
done
python3 scripts/check-release-tag.py "$RELEASE_TAG"
VERSION=$RELEASE_TAG
mvn -B -ntp -f maven/pom.xml -Prelease-artifacts,central-release \
"-Dcyclonedds.runtime.jar=$PWD/release/org.eclipse.cyclonedds-${VERSION}.jar" \
"-Dcyclonedds.idlc.verifiedJar=$PWD/release/org.eclipse.cyclonedds.idlc-${VERSION}.jar" \
"-Dgpg.keyname=$GPG_KEY_ID" deploy
- name: Save signed deployment bundle
if: always()
uses: actions/upload-artifact@v7
with:
name: maven-central-deployment
path: '**/target/central-publishing/*.zip'
if-no-files-found: ignore