Skip to content

Commit

Permalink
Use setup-gradle GitHub action (#155)
Browse files Browse the repository at this point in the history
  • Loading branch information
twyatt authored May 21, 2024
1 parent 8b4993a commit 9e3ce1a
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 47 deletions.
31 changes: 3 additions & 28 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,35 +11,10 @@ jobs:
with:
distribution: 'temurin'
java-version: '11'

- uses: actions/cache@v4
- uses: gradle/actions/setup-gradle@v3
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-build-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-build-
${{ runner.os }}-
validate-wrappers: true

- run: ./gradlew assemble
- run: ./gradlew check

- run: |
set -o xtrace
if [ ! -z "${{ secrets.SIGNING_KEY }}" ]; then
./gradlew \
-PVERSION_NAME="unspecified" \
-PsigningInMemoryKey="${{ secrets.SIGNING_KEY }}" \
-PsigningInMemoryKeyPassword="${{ secrets.SIGNING_PASSWORD }}" \
publishToMavenLocal
else
./gradlew \
-PVERSION_NAME="unspecified-SNAPSHOT" \
publishToMavenLocal
fi
if: ${{ github.repository_owner == 'JuulLabs' }}
- run: |
rm -f ~/.gradle/caches/modules-2/modules-2.lock
rm -f ~/.gradle/caches/modules-2/gc.properties
- run: ./gradlew -PRELEASE_SIGNING_ENABLED=false publishToMavenLocal
6 changes: 6 additions & 0 deletions .github/workflows/documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@ jobs:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '11'
- uses: gradle/actions/setup-gradle@v3

- run: ./gradlew dokkaHtmlMultiModule
- uses: JamesIves/github-pages-deploy-action@v4
with:
Expand Down
25 changes: 6 additions & 19 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,27 +13,14 @@ jobs:
with:
distribution: 'temurin'
java-version: '11'

- uses: actions/cache@v4
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-publish-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-publish-
${{ runner.os }}-
- uses: gradle/actions/setup-gradle@v3

- run: ./gradlew check
- run: >-
./gradlew
-PVERSION_NAME="${GITHUB_REF/refs\/tags\//}"
-PsigningInMemoryKey="${{ secrets.SIGNING_KEY }}"
-PsigningInMemoryKeyPassword="${{ secrets.SIGNING_PASSWORD }}"
-PmavenCentralUsername="${{ secrets.OSS_SONATYPE_NEXUS_USERNAME }}"
-PmavenCentralPassword="${{ secrets.OSS_SONATYPE_NEXUS_PASSWORD }}"
-PVERSION_NAME='${{ github.ref_name }}'
-PsigningInMemoryKey='${{ secrets.SIGNING_KEY }}'
-PsigningInMemoryKeyPassword='${{ secrets.SIGNING_PASSWORD }}'
-PmavenCentralUsername='${{ secrets.OSS_SONATYPE_NEXUS_USERNAME }}'
-PmavenCentralPassword='${{ secrets.OSS_SONATYPE_NEXUS_PASSWORD }}'
publish
- run: |
rm -f ~/.gradle/caches/modules-2/modules-2.lock
rm -f ~/.gradle/caches/modules-2/gc.properties
24 changes: 24 additions & 0 deletions .github/workflows/signing.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Validate Maven Signing
on:
push:
branches:
- main

jobs:
signing:
if: github.repository_owner == 'JuulLabs'
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17'
- uses: gradle/actions/setup-gradle@v3

- name: publishToMavenLocal
run: >
./gradlew
-PsigningInMemoryKey='${{ secrets.SIGNING_KEY }}'
-PsigningInMemoryKeyPassword='${{ secrets.SIGNING_PASSWORD }}'
publishToMavenLocal

0 comments on commit 9e3ce1a

Please sign in to comment.