forked from TencentBlueKing/bk-ci
-
Notifications
You must be signed in to change notification settings - Fork 0
78 lines (72 loc) · 2.89 KB
/
publishMavenJar4CI.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
# This workflow will build a Java project with Maven
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven
name: deploy CI jar to OSS
on:
push:
tags:
- 'v*'
jobs:
build:
runs-on: ubuntu-latest
services:
mysql:
image: mysql:8.0
env:
MYSQL_ROOT_PASSWORD: root
ports:
- 3306
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=10
steps:
- uses: actions/checkout@v2
- name: init mysql
run: |
export MYSQL_PWD=root
for i in *.sql;do echo $i;mysql -h 127.0.0.1 --port ${{ job.services.mysql.ports['3306'] }} -uroot < $i;done
working-directory: support-files/sql
- name: Set up JDK 1.8
uses: actions/setup-java@v1
with:
java-version: 1.8
- name: Cache Gradle packages
uses: actions/cache@v2
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}
restore-keys: ${{ runner.os }}-gradle
- name: Set up GPG
run: |
echo ${{ github.workspace }}
# gpg init
mkdir ~/.gnupg && echo use-agent >> ~/.gnupg/gpg.conf
echo pinentry-mode loopback >> ~/.gnupg/gpg.conf
echo allow-loopback-pinentry >> ~/.gnupg/gpg-agent.conf
echo RELOADAGENT | gpg-connect-agent
echo ${SIGNING_KEY} | awk '{gsub(/\\n/,"\n")}1'| gpg --dearmor > ${{ github.workspace }}/secretKeyRingFile.gpg
gpg --import --pinentry-mode loopback --batch --passphrase '${SIGNING_PASSWORD}' ${{ github.workspace }}/secretKeyRingFile.gpg
ls -al ${{ github.workspace }}
ls -al ~/.gnupg/
env:
SIGNING_KEY: ${{ secrets.SIGNING_KEY }}
SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }}
working-directory:
- name: Gradle Build
working-directory: src/backend/ci
env:
build_mavenRepoDeployUrl: "https://oss.sonatype.org/service/local/staging/deploy/maven2/"
build_mavenRepoUsername: ${{ secrets.SONATYPE_USERNAME }}
build_mavenRepoPassword: ${{ secrets.SONATYPE_PASSWORD }}
run: |
echo "GITHUB_REF=${GITHUB_REF}"
ci_version=${GITHUB_REF##*/v}
echo "ci_version=${ci_version}"
./gradlew publish -Dci_version=${ci_version} \
-Psigning.keyId=${{ secrets.SIGNING_KEY_ID }} \
-Psigning.password='${{ secrets.SIGNING_PASSWORD }}' \
-Psigning.secretKeyRingFile=${{ github.workspace }}/secretKeyRingFile.gpg \
-DmysqlURL=127.0.0.1:${{ job.services.mysql.ports['3306'] }} -DmysqlUser=root -DmysqlPasswd=root \
-Dorg.gradle.parallel=false
- name: Clean Up
if: ${{ always() }}
working-directory:
run: |
rm -rf ~/.gnupg