-
Notifications
You must be signed in to change notification settings - Fork 1
78 lines (71 loc) · 2.64 KB
/
deploy.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
name: deploy to sonatype
on:
push:
branches: [ release/** ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
cache: 'maven'
- name: Import GPG key
env:
GPG_PRIVATE_KEY_BASE64: ${{ secrets.GPG_PRIVATE_KEY_BASE64 }}
run: |
echo "$GPG_PRIVATE_KEY_BASE64" | base64 --decode > private-key.asc
gpg --batch --import private-key.asc
echo "no-tty" >> ~/.gnupg/gpg.conf
echo "batch" >> ~/.gnupg/gpg.conf
- name: Set GPG key trust level
run: |
KEY_ID=$(gpg --list-keys --with-colons | awk -F: '/^pub/ { print $5 }')
echo -e "5\ny\n" | gpg --command-fd 0 --batch --yes --edit-key $KEY_ID trust
- name: Configure Maven for GPG
env:
GPG_KEY_NAME: ${{ secrets.GPG_KEY_NAME }}
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
CENTRAL_USERNAME: ${{ secrets.SONARTYPE_USERNAME }}
CENTRAL_PASSWORD: ${{ secrets.SONARTYPE_PASSWORD }}
run: |
mkdir -p $HOME/.m2
echo "<settings>
<servers>
<server>
<id>central</id>
<username>$CENTRAL_USERNAME</username>
<password>$CENTRAL_PASSWORD</password>
</server>
<server>
<id>gpg.passphrase</id>
<passphrase>$GPG_PASSPHRASE</passphrase>
</server>
</servers>
<profiles>
<profile>
<id>gpg</id>
<properties>
<gpg.executable>gpg</gpg.executable>
<gpg.keyname>$GPG_KEY_NAME</gpg.keyname>
<gpg.passphraseServerId>$GPG_PASSPHRASE</gpg.passphraseServerId>
</properties>
</profile>
</profiles>
<activeProfiles>
<activeProfile>gpg</activeProfile>
</activeProfiles>
</settings>" > $HOME/.m2/settings-security.xml
- name: Build with Maven and sign artifacts
env:
GPG_TTY: $(tty)
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
GPG_KEY_NAME: ${{ secrets.GPG_KEY_NAME }}
working-directory: Hoodies-Network
run: |
export GPG_TTY=$(tty)
mvn clean deploy --settings $HOME/.m2/settings-security.xml