Skip to content

v0.8.0

v0.8.0 #127

name: Build and Publish
on:
release:
types: [created]
push:
branches:
- main
pull_request:
branches:
- main
jobs:
java_build:
name: Build and Publish Jar
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Get Version
run: |
# Strip git ref prefix from version
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')
# Strip "v" prefix from tag name
[[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//')
echo "VERSION=$VERSION" >> $GITHUB_ENV
- name: Set up JDK 17
uses: actions/setup-java@v1
with:
java-version: 17
server-id: github # Value of the distributionManagement/repository/id field of the pom.xml
distribution: zulu
- name: Build with Gradle
run: ./gradlew clean build jacocoTestReport --refresh-dependencies -Pversion=$VERSION
env:
GITHUB_ACTOR: ${{ github.actor }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# - name: Run Integration Tests with Gradle
# run: ./gradlew integrationTest -Pversion=$VERSION
# env:
# API_URL: ${{ secrets.INTEGRATION_TEST_API_URL }}
# PRIVATE_KEY: ${{ secrets.INTEGRATION_TEST_PRIVATE_KEY }}
# if: github.event_name == 'release'
- name: Install gpg secret key
run: |
export GPG_TTY=$(tty)
echo -n "${{ secrets.OSSRH_GPG_SECRET_KEY }}" | base64 --decode | gpg --batch --import
gpg --list-secret-keys --keyid-format LONG
echo -n "${{ secrets.OSSRH_GPG_SECRET_KEY }}" | base64 --decode > $GITHUB_WORKSPACE/release.gpg
if: github.event_name == 'release'
- name: Publish to Gradle Plugin Repository
run: |
./gradlew publishPlugins \
-Pversion=$VERSION \
-Pgradle.publish.key=$PUBLISH_KEY -Pgradle.publish.secret=$PUBLISH_SECRET \
-Psigning.keyId=B7D30ABE -Psigning.password="${{ secrets.OSSRH_GPG_SECRET_KEY_PASSWORD }}" -Psigning.secretKeyRingFile=$GITHUB_WORKSPACE/release.gpg
env:
PUBLISH_KEY: ${{ secrets.PUBLISH_KEY }}
PUBLISH_SECRET: ${{ secrets.PUBLISH_SECRET }}
if: github.event_name == 'release'
- name: Upload coverage to Codecov
uses: codecov/[email protected]
with:
token: ${{ secrets.CODECOV_TOKEN }}
directory: build/reports/jacoco/test/*.xml