-
Notifications
You must be signed in to change notification settings - Fork 1
52 lines (45 loc) · 1.6 KB
/
deploy.yml
File metadata and controls
52 lines (45 loc) · 1.6 KB
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
name: Release to Maven Central
on:
push:
tags:
- 'v*'
jobs:
deploy:
runs-on: ubuntu-latest
steps:
# 1. Checkout the code
- name: Checkout code
uses: actions/checkout@v2
# 2. Set up Java with version 17
- name: Set up Java
uses: actions/setup-java@v2
with:
java-version: '17'
distribution: 'temurin'
cache: maven
server-id: ossrh
server-username: ${{ secrets.GITHUB_ACTOR }} # Using GitHub username
server-password: ${{ secrets.MAVEN_GITHUB_TOKEN }} # Using the Maven GitHub Token
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }}
gpg-passphrase: ${{ secrets.GPG_PASSPHRASE }}
# 3. Create settings.xml for Maven
- name: Create settings.xml
run: |
mkdir -p ~/.m2
echo "<settings>
<servers>
<server>
<id>ossrh</id>
<username>${{ secrets.GITHUB_ACTOR }}</username>
<password>${{ secrets.MAVEN_GITHUB_TOKEN }}</password>
</server>
</servers>
</settings>" > ~/.m2/settings.xml
# 4. Debug settings.xml to check the configuration
- name: Debug settings.xml
run: cat ~/.m2/settings.xml
# 5. Build and deploy the project using Maven
- name: Build and deploy with Maven
run: mvn --batch-mode clean deploy -s ~/.m2/settings.xml -Dgpg.passphrase="${{ secrets.GPG_PASSPHRASE }}" -X
env:
MAVEN_GITHUB_TOKEN: ${{ secrets.MAVEN_GITHUB_TOKEN }}