Skip to content

Workflow file for this run

# 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:
tags:
- 'v*'
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_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}"
iamVersion=${GITHUB_REF##*/v}
echo "iamVersion=${iamVersion}"
chmod +x ./gradlew
./gradlew clean publish -DiamVersion=${iamVersion} \
-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