Skip to content

Commit cf77420

Browse files
authored
Merge pull request #749 from beehive-lab/feat/auto-deploy-with-action
[CI] Add GPG key configuration and Maven settings to `deploy-maven-ce…
2 parents ecebab2 + 7332462 commit cf77420

File tree

1 file changed

+37
-3
lines changed

1 file changed

+37
-3
lines changed

.github/workflows/deploy-maven-central.yml

Lines changed: 37 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,16 +23,50 @@ jobs:
2323
echo "$JAVA_HOME/bin" >> $GITHUB_PATH
2424
echo "$MAVEN_HOME/bin" >> $GITHUB_PATH
2525
26+
- name: Configure Maven settings
27+
run: |
28+
mkdir -p ~/.m2
29+
cat > ~/.m2/settings.xml << 'EOF'
30+
<settings>
31+
<servers>
32+
<server>
33+
<id>central</id>
34+
<username>${env.MAVEN_USERNAME}</username>
35+
<password>${env.MAVEN_PASSWORD}</password>
36+
</server>
37+
</servers>
38+
<profiles>
39+
<profile>
40+
<id>gpg</id>
41+
<properties>
42+
<gpg.executable>gpg</gpg.executable>
43+
<gpg.keyname>${env.GPG_KEYNAME}</gpg.keyname>
44+
<gpg.passphrase>${env.GPG_PASSPHRASE}</gpg.passphrase>
45+
</properties>
46+
</profile>
47+
</profiles>
48+
<activeProfiles>
49+
<activeProfile>gpg</activeProfile>
50+
</activeProfiles>
51+
</settings>
52+
EOF
53+
54+
- name: Import GPG key
55+
run: |
56+
echo "${{ secrets.GPG_PRIVATE_KEY }}" | gpg --batch --import
57+
env:
58+
GPG_TTY: $(tty)
59+
2660
- name: Deploy to Maven Central
2761
run: |
2862
mvn clean deploy \
2963
-pl tornado-api,tornado-runtime,tornado-matrices \
3064
-am \
3165
-P release \
3266
-DskipTests \
33-
--batch-mode \
34-
--no-transfer-progress
67+
--batch-mode
3568
env:
3669
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
3770
MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }}
38-
MAVEN_GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
71+
GPG_KEYNAME: ${{ secrets.GPG_KEYNAME }}
72+
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}

0 commit comments

Comments
 (0)