Adds support for promoting to maven central (#78)

* Adds support for promoting to maven central
This commit is contained in:
David O'Sullivan
2022-08-31 19:44:03 +01:00
committed by GitHub
parent 38691add52
commit d100e81d47
4 changed files with 78 additions and 1 deletions

View File

@@ -1,6 +1,8 @@
ARG base_image=ubuntu:bionic
FROM ${base_image}
ADD https://repo.spring.io/libs-release/io/spring/concourse/releasescripts/concourse-release-scripts/0.3.2/concourse-release-scripts-0.3.2.jar /opt/concourse-release-scripts.jar
RUN apt-get update && apt-get install --no-install-recommends -y \
git \
git gnupg \
&& rm -rf /var/lib/apt/lists/*

View File

@@ -4,6 +4,29 @@ set -euo pipefail
[[ -d "${PWD}"/maven && ! -d "${HOME}"/.m2 ]] && ln -s "${PWD}"/maven "${HOME}"/.m2
function clean_gpg {
FINGERPRINT=$(gpg --list-keys | head -4 | tail -1 | tr -d ' ')
gpg --batch --yes --delete-secret-keys "$FINGERPRINT"
gpg --batch --yes --delete-keys "$FINGERPRINT"
}
trap clean_gpg EXIT
gpg --batch --import-options import-show --import <(echo "$MAVEN_GPG_PRIVATE_KEY")
mkdir -p ~/.m2
cat <<EOF > ~/.m2/settings.xml
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 https://maven.apache.org/xsd/settings-1.0.0.xsd">
<servers>
<server>
<id>gpg.passphrase</id>
<passphrase>${MAVEN_GPG_PASSPHRASE}</passphrase>
</server>
</servers>
</settings>
EOF
REPOSITORY="${PWD}"/repository
cd source

View File

@@ -0,0 +1,9 @@
#!/usr/bin/env bash
set -euo pipefail
export BUILD_INFO_LOCATION=$(pwd)/repository/build-info.json
java -jar /opt/concourse-release-scripts.jar publishToCentral 'RELEASE' "$BUILD_INFO_LOCATION" repository
echo "Sync complete"