Skip to content

Maven Central release #40

Maven Central release

Maven Central release #40

name: Maven Central release
on:
workflow_dispatch:
jobs:
build_and_publish_package:
name: Build and publish maven packages
runs-on: ubuntu-latest
concurrency: publishing
steps:
- name: Checkout main
uses: actions/checkout@v2
- name: Bump package version
run: |
docker run --rm \
-v $PWD:/src \
-w /src \
tomologic/bumpversion --current-version $(cat VERSION) patch VERSION
- name: Checkout submodules using a PAT
run: |
git config --file .gitmodules --get-regexp url | while read url; do
git config --file=.gitmodules $(echo "$url" | sed -E "s/[email protected]:|https:\/\/github.com\//https:\/\/${{ secrets.OPENDATADISCOVERY_BOT_PAT }}:${{ secrets.OPENDATADISCOVERY_BOT_PAT }}@github.com\//")
done
git submodule sync
git submodule update --init --recursive
git submodule foreach git pull origin main
git checkout .gitmodules
- name: Deserialize secret key from base64
run: |
echo '${{ secrets.SIGNING_SECRET_KEY }}' > /tmp/secret_key_base64
base64 -d /tmp/secret_key_base64 > /tmp/secret_key.gpg
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
cache: 'gradle'
- name: Build and publish maven package
run: ./gradlew --no-daemon
-PsonatypeUsername=${{ secrets.SONATYPE_USERNAME }}
-PsonatypePassword=${{ secrets.SONATYPE_PASSWORD }}
-Psigning.keyId=${{ secrets.SIGNING_KEY_ID }}
-Psigning.password="${{ secrets.SIGNING_PASSWORD }}"
-Psigning.secretKeyRingFile=/tmp/secret_key.gpg
-Penv=prod
clean publishToSonatype closeAndReleaseSonatypeStagingRepository
- name: Update repository with up-to-date submodules and version
run: |
git config --global user.email "[email protected]"
git config --global user.name "OpenDataDiscovery Bot"
if [ -n "$(git status --porcelain)" ]
then
git add .
git commit -m "Update submodule branch ref and bump package version"
git push origin main
fi