-
Notifications
You must be signed in to change notification settings - Fork 26
77 lines (67 loc) · 2.37 KB
/
publish_module.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
name: Publish SDK Module manual
on:
workflow_dispatch:
inputs:
module:
description: 'select publish module'
required: true
default: 'autotracker-bom'
type: choice
options:
- autotracker-bom
- hybrid
- okhttp3
- urlconnection
- database
- debugger
- circler
- json
- protobuf
- encoder
- oaid
version:
description: 'input publish version'
required: false
default: 'DEFAULT'
type: string
jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up JDK 11
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: 11
# Gradle 缓存配置
- name: Cache Gradle packages
uses: actions/cache@v4
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
restore-keys: ${{ runner.os }}-gradle
# 给 gradlew 文件授权
- name: Grant Permission to Execute
run: |
chmod +x gradlew
chmod +x gradle/publishAllToMavenLocal.sh
# 构建项目
- name: Build with Gradle
run: |
bash ./gradle/publishAllToMavenLocal.sh
# 解码秘钥
- name: Decode
run: |
echo "${{secrets.SIGNING_SECRET_KEY_RING_FILE}}" > ~/.gradle/secring.gpg.b64
base64 -d ~/.gradle/secring.gpg.b64 > ~/.gradle/secring.gpg
- name: Publish to Sonatype
env:
NEXUS_USERNAME: ${{ secrets.NEXUS_USERNAME }}
NEXUS_PASSWORD: ${{ secrets.NEXUS_PASSWORD }}
run: ./gradlew publish -PCI_SELECT_MODULE="${{ inputs.module }}" -PCI_SELECT_VERSION="${{ inputs.version }}" -PNEXUS_USERNAME="${NEXUS_USERNAME}" -PNEXUS_PASSWORD="${NEXUS_PASSWORD}" -Psigning.keyId=${{secrets.SIGNING_KEY_ID}} -Psigning.password=${{secrets.SIGNING_PASSWORD}} -Psigning.secretKeyRingFile=$(echo ~/.gradle/secring.gpg)
- name: Close And Release Package
env:
NEXUS_USERNAME: ${{ secrets.NEXUS_USERNAME }}
NEXUS_PASSWORD: ${{ secrets.NEXUS_PASSWORD }}
run: ./gradlew tryCloseAndReleaseRepository -PNEXUS_USERNAME="${NEXUS_USERNAME}" -PNEXUS_PASSWORD="${NEXUS_PASSWORD}"