Skip to content

Commit df71e7e

Browse files
Upload to Maven
1 parent b6bbc9c commit df71e7e

File tree

2 files changed

+27
-1
lines changed

2 files changed

+27
-1
lines changed

.github/workflows/github_actions.yml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,16 @@ jobs:
3434
tag_name: ${{ github.event.release.tag_name }}
3535
name: ${{ github.event.release.tag_name }}
3636
draft: false
37-
prerelease: false
37+
prerelease: false
38+
39+
- name: Upload to maven
40+
run: |
41+
chmod +x ./ci/upload_to_maven.sh
42+
./ci/upload_to_maven.sh
43+
shell: bash
44+
env:
45+
GPG_KEY_ID: ${{ secrets.GPG_KEY_ID }}
46+
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
47+
GPG_SECRET_KEYS_ENC: ${{ secrets.GPG_SECRET_KEYS_ENC }}
48+
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
49+
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}

ci/upload_to_maven.sh

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/usr/bin/env bash
2+
3+
export GPG_KEY_LOCATION=$(pwd)/encrypted.key
4+
echo "Starting upload to maven"
5+
echo "${GPG_SECRET_KEYS_ENC}" | base64 --decode > $GPG_KEY_LOCATION
6+
./gradlew properties -q | grep "version:" | awk '{print $2}'
7+
export PROJECT_VERSION=$(./gradlew properties -q | grep "version:" | awk '{print $2}')
8+
# Upload only snapshots to sonatype oss so it can make its way to maven central
9+
./gradlew publishMavenJavaPublicationToMavenRepository
10+
11+
# Only non-snapshot can be pushed as maven releases
12+
if [[ ! $(echo "${PROJECT_VERSION}" | grep "SNAPSHOT") ]]; then
13+
./gradlew closeAndReleaseRepository
14+
fi

0 commit comments

Comments
 (0)