-
Notifications
You must be signed in to change notification settings - Fork 7
100 lines (92 loc) · 3.18 KB
/
maven-publish.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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
name: Publish package to the Maven Central Repository and GitHub Packages
'on':
push:
branches:
- master
jobs:
publish:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v3
- name: Set up Java for publishing to Maven Central Repository
uses: actions/setup-java@v1
with:
java-version: '8'
distribution: 'zulu'
server-id: ossrh
server-username: MAVEN_USERNAME
server-password: MAVEN_PASSWORD
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }}
gpg-passphrase: GPG_PASSPHRASE
- name: Publish to the Maven Central Repository
run: mvn -DskipTests --batch-mode deploy -Possrh
env:
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }}
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE}}
github_publish:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
java-version: '8'
distribution: 'zulu'
server-id: github_auth
- name: Publish package
run: mvn -DskipTests --batch-mode deploy -P github_auth
env:
GITHUB_TOKEN: ${{ secrets.SECRET_KEY }}
# publish:
# # 任务运行的环境
# runs-on: ubuntu-latest
# # 任务的步骤
# steps:
# # 1. 声明 checkout 仓库代码到工作区
# - name: Checkout Git Repo
# uses: actions/checkout@v2
# # 2. 安装Java 环境 这里会用到的参数就是 Git Action secrets中配置的,
# # 取值要在key前面加 secrets.
# - name: Set up Maven Central Repo
# uses: actions/setup-java@v1
# with:
# java-version: 1.8
# server-id: ossrh
# server-username: ${{ secrets.OSSRH_USERNAME }}
# server-password: ${{ secrets.OSSRH_PASSWORD }}
# gpg-passphrase: ${{ secrets.GPG_PASSPHRASE }}
# # 3. 发布到Maven中央仓库
# - name: Publish to Maven Central Repo
# # 这里用到了其他人写的action脚本,详细可以去看他的文档。
# run: mvn -DskipTests --batch-mode deploy -P ossrh
# uses: samuelmeuli/action-maven-publish@v1
# with:
# gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
# gpg_passphrase: ${{ secrets.GPG_PASSPHRASE }}
# nexus_username: ${{ secrets.OSSRH_USER }}
# nexus_password: ${{ secrets.OSSRH_USERNAME }}
# uses: actions/setup-java@v3
# with:
# java-version: '11'
# distribution: 'adopt'
# - name: Publish to GitHub Packages
# run: mvn -DskipTests --batch-mode deploy -P github_auth
# env:
# GITHUB_TOKEN: ${{ secrets.SECRET_KEY }}
# steps:
# - uses: actions/checkout@v3
# - uses: actions/setup-java@v3
# with:
# java-version: '8'
# distribution: 'zulu'
# server-id: github_auth
# - name: Publish package
# run: mvn -DskipTests --batch-mode deploy -P github_auth
# env:
# GITHUB_TOKEN: ${{ secrets.SECRET_KEY }}