Skip to content

Attach Release

Attach Release #19

Workflow file for this run

name: Attach Release
on:
push:
tags:
- '*'
jobs:
build:
name: Deploy
runs-on: macos-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 5
persist-credentials: false
- name: Setup Java
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '17'
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Import GPG keys
run: |
gpg --import --batch <(echo "$GPG_PRIVATE_KEY") &> /dev/null
# Gradle doesn't support GPG 2.1 and later: https://github.com/gradle/gradle/issues/888
gpg --export-secret-keys --pinentry-mode loopback --passphrase="$GPG_PASSPHRASE" > ~/.gnupg/secring.gpg
rm -rf /tmp/secret
env:
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
- name: Deploy to Sonatype Nexus
id: deploy
run: |
export ANDROID_SDK=$ANDROID_HOME
./gradlew publish closeAndReleaseSonatypeStagingRepository --info -PsonatypeUsername=$SONATYPE_USERNAME -PsonatypePassword=$SONATYPE_PASSWORD -Psigning.keyId=$GPG_KEYNAME -Psigning.password=$GPG_PASSPHRASE -Psigning.secretKeyRingFile=$HOME/.gnupg/secring.gpg
echo ::set-output name=exit_code::$?
env:
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
GPG_KEYNAME: ${{ secrets.GPG_KEYNAME }}
- name: Release Javadocs to S3
if: steps.deploy.outputs.exit_code == 0
run: |
TAG=${GITHUB_REF/refs\/tags\//}
./gradlew javadoc
aws s3 cp --recursive build/docs/javadoc/ $AWS_S3_BUCKET_DOCS/attach/javadoc/$TAG/ --acl public-read --region us-east-1
# Update /latest with release version
aws s3 sync $AWS_S3_BUCKET_DOCS/attach/javadoc/$TAG/ $AWS_S3_BUCKET_DOCS/attach/javadoc/latest/ --acl public-read --region us-east-1
env:
AWS_S3_BUCKET_DOCS: ${{ secrets.AWS_S3_BUCKET_DOCS }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_KEY }}
- name: Commit next development version
if: steps.deploy.outputs.exit_code == 0
run: |
brew install gnu-sed
git config user.email "githubbot@gluonhq.com"
git config user.name "Gluon Bot"
TAG=${GITHUB_REF/refs\/tags\//}
newVersion=${TAG%.*}.$((${TAG##*.} + 1)) # Update version by 1
gsed -i -z "0,/version = $TAG/s//version = $newVersion-SNAPSHOT/" gradle.properties
git commit gradle.properties -m "Prepare development of $newVersion"
git push https://gluon-bot:$PAT@github.com/$GITHUB_REPOSITORY HEAD:master
env:
PAT: ${{ secrets.GITHUB_TOKEN }}