Add release instructions & build caches

This commit is contained in:
Justin Abrahms 2022-06-24 00:04:35 -05:00
parent f89b476db8
commit d8c82be099
No known key found for this signature in database
GPG Key ID: 599E2E12011DC474
4 changed files with 58 additions and 12 deletions

View File

@ -32,6 +32,14 @@ jobs:
server-username: ${{ secrets.OSSRH_USERNAME }} server-username: ${{ secrets.OSSRH_USERNAME }}
server-password: ${{ secrets.OSSRH_PASSWORD }} server-password: ${{ secrets.OSSRH_PASSWORD }}
- name: Cache local Maven repository
uses: actions/cache@v2
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Configure GPG Key - name: Configure GPG Key
run: | run: |
echo -n "$GPG_SIGNING_KEY" | base64 --decode | gpg --import echo -n "$GPG_SIGNING_KEY" | base64 --decode | gpg --import

View File

@ -18,6 +18,15 @@ jobs:
java-version: '8' java-version: '8'
distribution: 'temurin' distribution: 'temurin'
cache: maven cache: maven
- name: Cache local Maven repository
uses: actions/cache@v2
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Configure GPG Key - name: Configure GPG Key
run: | run: |
echo -n "$GPG_SIGNING_KEY" | base64 --decode | gpg --import echo -n "$GPG_SIGNING_KEY" | base64 --decode | gpg --import

View File

@ -5,6 +5,8 @@
# This workflow will build a package using Gradle and then publish it to GitHub packages when a release is created # This workflow will build a package using Gradle and then publish it to GitHub packages when a release is created
# For more information see: https://github.com/actions/setup-java/blob/main/docs/advanced-usage.md#Publishing-using-gradle # For more information see: https://github.com/actions/setup-java/blob/main/docs/advanced-usage.md#Publishing-using-gradle
# maven deploy commands via via https://tech.clevertap.com/automate-releases-to-maven-central-via-github-actions/
name: Release name: Release
on: on:
@ -26,16 +28,34 @@ jobs:
with: with:
java-version: '8' java-version: '8'
distribution: 'temurin' distribution: 'temurin'
- name: Build with Gradle cache: maven
uses: gradle/gradle-build-action@0d13054264b0bb894ded474f08ebb30921341cee server-id: ossrh
with: server-username: ${{ secrets.OSSRH_USERNAME }}
arguments: build server-password: ${{ secrets.OSSRH_PASSWORD }}
# The USERNAME and TOKEN need to correspond to the credentials environment variables used in
# the publishing section of your build.gradle - name: Configure GPG Key
- name: Publish to Sonatype (Maven) run: |
uses: gradle/gradle-build-action@0d13054264b0bb894ded474f08ebb30921341cee echo -n "$GPG_SIGNING_KEY" | base64 --decode | gpg --import
with:
arguments: publish -PossrhUsername=${{ secrets.OSSRH_USERNAME }} -PossrhPassword=${{ secrets.OSSRH_PASSWORD }}
env: env:
release: true GPG_SIGNING_KEY: ${{ secrets.GPG_SIGNING_KEY }}
REPOSITORY_URL: https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/
- name: Build with Maven
run: mvn --batch-mode --update-snapshots verify
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v2
with:
directory: lib/build
flags: unittests # optional
name: coverage # optional
fail_ci_if_error: true # optional (default = false)
verbose: true # optional (default = false)
- name: Deploy
run: |
mvn -P gpg_verify \
--no-transfer-progress \
--batch-mode \
--file pom.xml -s release/m2-settings.xml verify deploy
env:
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}

9
release/m2-settings.xml Normal file
View File

@ -0,0 +1,9 @@
<settings>
<servers>
<server>
<id>ossrh</id>
<username>${env.OSSRH_USERNAME}</username>
<password>${env.OSSRH_PASSWORD}</password>
</server>
</servers>
</settings>