This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 iam-java-sdk jar to OSS snapshot repository | |
on: | |
push: | |
branches: | |
- master | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- 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 }} | |
- name: Gradle Build | |
env: | |
build_snapshotMavenRepoDeployUrl: "https://oss.sonatype.org/content/repositories/snapshots" | |
build_snapshotMavenRepoUsername: ${{ secrets.SONATYPE_USERNAME }} | |
build_snapshotMavenRepoPassword: ${{ secrets.SONATYPE_PASSWORD }} | |
run: | | |
echo "GITHUB_REF=${GITHUB_REF}" | |
chmod +x ./gradlew | |
./gradlew clean publish -Dsnapshot=true \ | |
-Psigning.keyId=${{ secrets.SIGNING_KEY_ID }} \ | |
-Psigning.password='${{ secrets.SIGNING_PASSWORD }}' \ | |
-Psigning.secretKeyRingFile=${{ github.workspace }}/secretKeyRingFile.gpg | |
- name: Clean Up | |
if: ${{ always() }} | |
run: | | |
rm -rf ~/.gnupg |