Skip to content

Commit 37ecbb9

Browse files
Update
1 parent a015e99 commit 37ecbb9

2 files changed

Lines changed: 28 additions & 12 deletions

File tree

.github/workflows/deploy.yml

Lines changed: 26 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,30 +6,46 @@ on:
66
- 'v*'
77

88
jobs:
9-
publish:
9+
deploy:
1010
runs-on: ubuntu-latest
1111

1212
steps:
13-
- name: Checkout source code
14-
uses: actions/checkout@v4
13+
# 1. Checkout the code
14+
- name: Checkout code
15+
uses: actions/checkout@v2
1516

17+
# 2. Set up Java with version 17
1618
- name: Set up Java
17-
uses: actions/setup-java@v3
19+
uses: actions/setup-java@v2
1820
with:
19-
distribution: temurin
20-
java-version: 17
21+
java-version: '17'
2122
cache: maven
2223
server-id: ossrh
23-
server-username: ${{ secrets.SONATYPE_USERNAME }}
24-
server-password: ${{ secrets.SONATYPE_TOKEN }}
24+
server-username: ${{ secrets.GITHUB_ACTOR }} # Using GitHub username
25+
server-password: ${{ secrets.MAVEN_GITHUB_TOKEN }} # Using the Maven GitHub Token
2526
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }}
2627
gpg-passphrase: ${{ secrets.GPG_PASSPHRASE }}
2728

29+
# 3. Create settings.xml for Maven
30+
- name: Create settings.xml
31+
run: |
32+
mkdir -p ~/.m2
33+
echo "<settings>
34+
<servers>
35+
<server>
36+
<id>ossrh</id>
37+
<username>${{ secrets.GITHUB_ACTOR }}</username>
38+
<password>${{ secrets.MAVEN_GITHUB_TOKEN }}</password>
39+
</server>
40+
</servers>
41+
</settings>" > ~/.m2/settings.xml
42+
43+
# 4. Debug settings.xml to check the configuration
2844
- name: Debug settings.xml
2945
run: cat ~/.m2/settings.xml
3046

47+
# 5. Build and deploy the project using Maven
3148
- name: Build and deploy with Maven
3249
run: mvn --batch-mode clean deploy -s ~/.m2/settings.xml -Dgpg.passphrase="${{ secrets.GPG_PASSPHRASE }}" -X
3350
env:
34-
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
35-
SONATYPE_TOKEN: ${{ secrets.SONATYPE_TOKEN }}
51+
MAVEN_GITHUB_TOKEN: ${{ secrets.MAVEN_GITHUB_TOKEN }}

settings.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
<servers>
99
<server>
1010
<id>ossrh</id>
11-
<username>${{ secrets.SONATYPE_USERNAME }}</username>
12-
<password>${{ secrets.SONATYPE_TOKEN }}</password>
11+
<username>${{ secrets.GITHUB_ACTOR }}</username>
12+
<password>${{ secrets.MAVEN_GITHUB_TOKEN }}</password>
1313
</server>
1414
</servers>
1515
</settings>

0 commit comments

Comments
 (0)