File tree Expand file tree Collapse file tree 1 file changed +51
-0
lines changed Expand file tree Collapse file tree 1 file changed +51
-0
lines changed Original file line number Diff line number Diff line change 1+ name : Release to Maven Central
2+
3+ on :
4+ release :
5+ types : [created]
6+
7+ jobs :
8+ build :
9+ runs-on : ubuntu-latest
10+
11+ steps :
12+ - uses : actions/checkout@v3
13+
14+ - name : Import GPG key
15+ run : |
16+ echo "$GPG_PRIVATE_KEY" | base64 --decode | gpg --batch --yes --import
17+ env :
18+ GPG_PRIVATE_KEY : ${{ secrets.GPG_PRIVATE_KEY }}
19+
20+ - name : Set up gpg-agent
21+ run : |
22+ echo "allow-loopback-pinentry" >> ~/.gnupg/gpg-agent.conf
23+ echo RELOADAGENT | gpg-connect-agent
24+ echo -e "pinentry-mode loopback\n" >> ~/.gnupg/gpg.conf
25+
26+ - name : Set up Maven Central settings
27+ run : |
28+ mkdir -p ~/.m2
29+ cat <<EOF > ~/.m2/settings.xml
30+ <settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
31+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
32+ xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 https://maven.apache.org/xsd/settings-1.0.0.xsd">
33+ <servers>
34+ <server>
35+ <id>central</id>
36+ <username>${{ secrets.MAVEN_CENTRAL_USERNAME }}</username>
37+ <password>${{ secrets.MAVEN_CENTRAL_TOKEN }}</password>
38+ </server>
39+ </servers>
40+ </settings>
41+ EOF
42+
43+ - name : Build with Maven
44+ run : |
45+ mvn clean deploy -Dgpg.passphrase=$GPG_PASSPHRASE \
46+ -Dgpg.keyname=$GPG_KEY_ID \
47+ -Dgpg.executable=gpg \
48+ -Dgpg.pinentry.mode=loopback
49+ env :
50+ GPG_PASSPHRASE : ${{ secrets.GPG_PASSPHRASE }}
51+ GPG_KEY_ID : ${{ secrets.GPG_KEY_ID }}
You can’t perform that action at this time.
0 commit comments