Skip to content

Commit

Permalink
Replace GPG-encrypted secrets with Gradle properties
Browse files Browse the repository at this point in the history
Easier to handle and more common to use.
  • Loading branch information
saschpe committed Mar 23, 2024
1 parent 963b703 commit 8d5a1f8
Show file tree
Hide file tree
Showing 8 changed files with 45 additions and 130 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,10 @@ jobs:
if: github.ref == 'refs/heads/main'
environment: Sonatype
env:
ORG_GRADLE_PROJECT_sonatypePass: ${{ secrets.SONATYPE_API_KEY }}
ORG_GRADLE_PROJECT_sonatypeUser: ${{ secrets.SONATYPE_USER }}
SONATYPE_GPG_KEY: ${{ secrets.SONATYPE_GPG_KEY }}
SONATYPE_GPG_KEY_PASSWORD: ${{ secrets.SONATYPE_GPG_KEY_PASSWORD }}
SECRETS_KEY: ${{ secrets.SECRETS_KEY }}
steps:
- uses: actions/checkout@v4
- name: Set up JDK 17
Expand Down
35 changes: 0 additions & 35 deletions buildSrc/build.gradle.kts

This file was deleted.

Binary file removed buildSrc/src/main/kotlin/Secrets.kt.gpg
Binary file not shown.
13 changes: 12 additions & 1 deletion log4k-slf4j/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -72,14 +72,25 @@ publishing {
}
}

<<<<<<< Updated upstream
repositories {
maven {
name = "sonatype"
credentials {
username = Secrets.Sonatype.user
password = Secrets.Sonatype.apiKey
=======
if (hasProperty("sonatypeUser") && hasProperty("sonatypePass")) {
repositories {
maven {
name = "sonatype"
credentials {
username = property("sonatypeUser") as String
password = property("sonatypePass") as String
}
url = uri("https://oss.sonatype.org/service/local/staging/deploy/maven2")
>>>>>>> Stashed changes
}
url = uri("https://oss.sonatype.org/service/local/staging/deploy/maven2")
}
}
}
Expand Down
13 changes: 12 additions & 1 deletion log4k/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -69,14 +69,25 @@ publishing {
}
}

<<<<<<< Updated upstream
repositories {
maven {
name = "sonatype"
credentials {
username = Secrets.Sonatype.user
password = Secrets.Sonatype.apiKey
=======
if (hasProperty("sonatypeUser") && hasProperty("sonatypePass")) {
repositories {
maven {
name = "sonatype"
credentials {
username = property("sonatypeUser") as String
password = property("sonatypePass") as String
}
url = uri("https://oss.sonatype.org/service/local/staging/deploy/maven2")
>>>>>>> Stashed changes
}
url = uri("https://oss.sonatype.org/service/local/staging/deploy/maven2")
}
}
}
Expand Down
35 changes: 18 additions & 17 deletions scripts/inc.functions.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env sh
#
# Collection of shared functions
#
Expand All @@ -8,35 +8,36 @@ RED='\033[0;31m'
YELLOW='\033[0;33m'
NC='\033[0m' # No Color

function approve() {
echo -e "${GREEN}$@${NC}"
approve() {
printf "${GREEN}%s${NC}\n" "$*"
}

function warn() {
echo -e "${YELLOW}$@${NC}"
warn() {
printf "${YELLOW}%s${NC}\n" "$*"
}

function die() {
echo -e "${RED}$@${NC}"
die() {
printf "${RED}%s${NC}\n" "$*"
exit 1
}

function safe() {
safe() {
"$@"
local status=$?
if [[ ${status} -ne 0 ]]; then
die "\nBUILD FAILED\nAfter invoking \"$@\"\n" >&2
_status=$?
if [ ${_status} -ne 0 ]; then
die "\nBUILD FAILED\nAfter invoking \"$*\"\n" >&2
fi
return ${status}
return ${_status}
}

function sed2() {
sed -i'.bak' "$1" ${@:2}
for file in "${@:2}"; do
sed2() {
_args=$(echo "${@}" | cut -d" " -f2-)
sed -i'.bak' "$1" "${_args}"
for file in ${_args}; do
rm "${file}.bak"
done
}

function get_version_name() {
echo $(grep "version = " $1 | xargs | cut -d"=" -f2)
get_version_name() {
grep "version = " "$1" | xargs | cut -d"=" -f2
}
2 changes: 1 addition & 1 deletion scripts/publish
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash
#
# Script to publish libary in case a release commit is discovered
# Script to publish library in case a release commit is discovered
#

SCRIPT_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
Expand Down
74 changes: 0 additions & 74 deletions scripts/secret

This file was deleted.

0 comments on commit 8d5a1f8

Please sign in to comment.