Skip to content

feat:流水线支持归档目录 #9320 #15

feat:流水线支持归档目录 #9320

feat:流水线支持归档目录 #9320 #15

# 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
- name: Clean Up
if: ${{ always() }}
working-directory:
run: |
rm -rf ~/.gnupg