Skip to content

Commit 30e72bc

Browse files
authored
build: Add environment variables for global resolver setup (#2371)
Updated the publish-maven.sh script to skip merging if the settings file already exists, indicating that it should be preconfigured for Sonatype publishing. Removed installation step for xmlstarlet from the workflow.
1 parent 7b73a60 commit 30e72bc

File tree

2 files changed

+5
-20
lines changed

2 files changed

+5
-20
lines changed

.github/publish-maven.sh

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -35,21 +35,7 @@ MVN_SETTINGS_FILE="$HOME/.m2/settings.xml"
3535
mkdir -p "$(dirname "$MVN_SETTINGS_FILE")"
3636

3737
if [ -f "$MVN_SETTINGS_FILE" ]; then
38-
echo "⚙️ Settings file found. Merging publishing configuration..."
39-
xmlstarlet ed -L \
40-
-s /settings -t elem -n servers -v "" \
41-
-s /settings/servers[1] -t elem -n server \
42-
-i /settings/servers[1]/server[1] -t attr -n id -v central \
43-
-s /settings/servers[1]/server[1] -t elem -n username -v '${SONATYPE_USERNAME}' \
44-
-s /settings/servers[1]/server[1] -t elem -n password -v '${SONATYPE_PASSWORD}' \
45-
"$MVN_SETTINGS_FILE"
46-
xmlstarlet ed -L \
47-
-s '/settings/profiles/profile[id="akka-repo"]' -t elem -n activation -v "" \
48-
-s '/settings/profiles/profile[id="akka-repo"]/activation' -t elem -n activeByDefault -v "true" \
49-
-s '/settings/profiles/profile[id="akka-repo"]' -t elem -n properties -v "" \
50-
-s '/settings/profiles/profile[id="akka-repo"]/properties' -t elem -n gpg.passphrase -v '${PGP_PASSPHRASE}' \
51-
"$MVN_SETTINGS_FILE"
52-
echo "✅ Merge complete."
38+
echo "✅ Settings file already exists. It is expected to be set up with Sonatype publishing details already, so doing nothing to the file."
5339
else
5440
echo "✨ Settings file not found. Creating a new one with publishing configuration."
5541
cat <<EOF >"$MVN_SETTINGS_FILE"

.github/workflows/publish.yml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,10 @@ jobs:
4444
path: scripts
4545

4646
- name: Setup global resolver
47+
env:
48+
PGP_PASSPHRASE: ${{ secrets.PGP_PASSPHRASE }}
49+
PUBLISH_USER: ${{ secrets.PUBLISH_USER }}
50+
PUBLISH_PASSWORD: ${{ secrets.PUBLISH_PASSWORD }}
4751
run: |
4852
chmod +x ./scripts/setup_global_resolver.sh
4953
./scripts/setup_global_resolver.sh
@@ -66,11 +70,6 @@ jobs:
6670
- name: sbt publishM2
6771
run: sbt +publishM2
6872

69-
- name: Install xmlstarlet
70-
run: |
71-
sudo apt-get update
72-
sudo apt-get install -y xmlstarlet
73-
7473
- name: mvn deploy
7574
run: |-
7675
export SDK_VERSION="$(cat ~/kalix-sdk-version.txt)"

0 commit comments

Comments
 (0)