Skip to content

Commit bd04275

Browse files
committed
fix: another try to fix the MC_release workflow
1 parent 8350475 commit bd04275

File tree

1 file changed

+54
-9
lines changed

1 file changed

+54
-9
lines changed

.github/workflows/mc_release.yml

Lines changed: 54 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,38 +9,83 @@ jobs:
99
runs-on: ubuntu-latest
1010
permissions:
1111
contents: read
12+
1213
env:
1314
CENTRAL_USERNAME: ${{ secrets.OSSRH_USERNAME }}
1415
CENTRAL_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
1516

1617
steps:
17-
- uses: actions/checkout@v4
18+
- name: Checkout
19+
uses: actions/checkout@v4
20+
with:
21+
fetch-depth: 0
22+
23+
# ──────────────────────────────────────────────────────
24+
# 1. Gen Passphrase
25+
# ──────────────────────────────────────────────────────
26+
- name: Export GPG Passphrase to Environment
27+
run: |
28+
echo "GPG_PASSPHRASE_ENV=${{ secrets.GPG_PASSPHRASE }}" >> $GITHUB_ENV
1829
19-
- name: Set up JDK
30+
# ──────────────────────────────────────────────────────
31+
# 2. JDK + Key Import
32+
# ──────────────────────────────────────────────────────
33+
- name: Set up JDK 17
2034
uses: actions/setup-java@v4
2135
with:
2236
distribution: temurin
2337
java-version: "17"
2438
cache: maven
2539
gpg-private-key: ${{ secrets.GPG_KEY }}
26-
gpg-passphrase: ${{ secrets.GPG_PASSPHRASE }}
40+
gpg-passphrase: GPG_PASSPHRASE_ENV
2741

28-
- name: Write ~/.m2/settings.xml for Central
42+
# ──────────────────────────────────────────────────────
43+
# 3. GPG Agent
44+
# ──────────────────────────────────────────────────────
45+
- name: Configure GPG Agent (Loopback)
46+
run: |
47+
mkdir -p ~/.gnupg
48+
echo "allow-loopback-pinentry" >> ~/.gnupg/gpg-agent.conf
49+
echo "pinentry-mode loopback" >> ~/.gnupg/gpg.conf
50+
gpg-connect-agent reloadagent /bye
51+
52+
# ──────────────────────────────────────────────────────
53+
# 4. settings.xml
54+
# ──────────────────────────────────────────────────────
55+
- name: Create ~/.m2/settings.xml
2956
run: |
3057
mkdir -p ~/.m2
31-
cat > ~/.m2/settings.xml <<'XML'
58+
cat > ~/.m2/settings.xml <<'EOF'
3259
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
3360
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
34-
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 https://maven.apache.org/xsd/settings-1.0.0.xsd">
61+
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
62+
https://maven.apache.org/xsd/settings-1.0.0.xsd">
3563
<servers>
3664
<server>
3765
<id>central</id>
3866
<username>${env.CENTRAL_USERNAME}</username>
3967
<password>${env.CENTRAL_PASSWORD}</password>
4068
</server>
4169
</servers>
70+
<profiles>
71+
<profile>
72+
<id>gpg</id>
73+
<properties>
74+
<gpg.passphrase>${env.GPG_PASSPHRASE_ENV}</gpg.passphrase>
75+
</properties>
76+
</profile>
77+
</profiles>
78+
<activeProfiles>
79+
<activeProfile>gpg</activeProfile>
80+
</activeProfiles>
4281
</settings>
43-
XML
82+
EOF
4483
45-
- name: Build & Publish (Central)
46-
run: mvn -B -DskipTests clean deploy
84+
# ──────────────────────────────────────────────────────
85+
# 5. Deploy
86+
# ──────────────────────────────────────────────────────
87+
- name: Build & Publish
88+
run: |
89+
mvn -B -DskipTests clean deploy \
90+
-P gpg \
91+
-s ~/.m2/settings.xml

0 commit comments

Comments
 (0)