Skip to content

Commit

Permalink
chore: Upgrade github actions and use standard gradle actions
Browse files Browse the repository at this point in the history
  • Loading branch information
Chuckame committed Apr 11, 2024
1 parent f0ec3bb commit 06afd4a
Show file tree
Hide file tree
Showing 3 changed files with 89 additions and 91 deletions.
84 changes: 42 additions & 42 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,47 +1,47 @@
name: build-main

on:
push:
branches:
- main
- release/*
paths-ignore:
- 'doc/**'
- '*.md'
push:
branches:
- main
- release/*
paths-ignore:
- 'doc/**'
- '*.md'

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout the repo
uses: actions/checkout@v3

- name: Run tests
run: ./gradlew check

- name: Bundle the build report
if: failure()
run: find . -type d -name 'reports' | zip -@ -r build-reports.zip

- name: Upload the build report
if: failure()
uses: actions/upload-artifact@v3
with:
name: error-report
path: build-reports.zip

deploy:
needs: build
runs-on: ubuntu-latest
steps:
- name: Checkout the repo
uses: actions/checkout@v3

- name: deploy to sonatype snapshots
run: ./gradlew publish
env:
ORG_GRADLE_PROJECT_sonatypeUsername: ${{ secrets.OSSRH_USERNAME }}
ORG_GRADLE_PROJECT_sonatypePassword: ${{ secrets.OSSRH_PASSWORD }}

env:
GRADLE_OPTS: -Dorg.gradle.configureondemand=true -Dorg.gradle.parallel=false -Dkotlin.incremental=false -Dorg.gradle.jvmargs="-Xmx3g -XX:MaxPermSize=2048m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8"
build:
runs-on: ubuntu-latest
steps:
- name: Checkout the repo
uses: actions/checkout@v4
- name: Setup Gradle
uses: gradle/gradle-build-action@v3

- name: Run tests
run: ./gradlew check

- name: Bundle the build report
if: failure()
run: find . -type d -name 'reports' | zip -@ -r build-reports.zip
- name: Upload the build report
if: failure()
uses: actions/upload-artifact@v3
with:
name: error-report
path: build-reports.zip

deploy:
needs: build
runs-on: ubuntu-latest
steps:
- name: Checkout the repo
uses: actions/checkout@v4
- name: Setup Gradle
uses: gradle/gradle-build-action@v3

- name: deploy to sonatype snapshots
run: ./gradlew publish
env:
ORG_GRADLE_PROJECT_sonatypeUsername: ${{ secrets.OSSRH_USERNAME }}
ORG_GRADLE_PROJECT_sonatypePassword: ${{ secrets.OSSRH_PASSWORD }}
45 changes: 22 additions & 23 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
@@ -1,31 +1,30 @@
name: build-pr

on:
pull_request:
paths-ignore:
- 'doc/**'
- '*.md'
pull_request:
paths-ignore:
- 'doc/**'
- '*.md'

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout the repo
uses: actions/checkout@v3
build:
runs-on: ubuntu-latest
steps:
- name: Checkout the repo
uses: actions/checkout@v4
- name: Setup Gradle
uses: gradle/gradle-build-action@v3

- name: Run tests
run: ./gradlew check
- name: Run tests
run: ./gradlew check

- name: Bundle the build report
if: failure()
run: find . -type d -name 'reports' | zip -@ -r build-reports.zip
- name: Bundle the build report
if: failure()
run: find . -type d -name 'reports' | zip -@ -r build-reports.zip

- name: Upload the build report
if: failure()
uses: actions/upload-artifact@v3
with:
name: error-report
path: build-reports.zip

env:
GRADLE_OPTS: -Dorg.gradle.configureondemand=true -Dorg.gradle.parallel=false -Dkotlin.incremental=false -Dorg.gradle.jvmargs="-Xmx3g -XX:MaxPermSize=2048m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8"
- name: Upload the build report
if: failure()
uses: actions/upload-artifact@v3
with:
name: error-report
path: build-reports.zip
51 changes: 25 additions & 26 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,32 +1,31 @@
name: release

on:
workflow_dispatch:
inputs:
version:
description: "The release version (e.g., '1.9.0')."
required: true
workflow_dispatch:
inputs:
version:
description: "The release version (e.g., '1.9.0')."
required: true

jobs:
publish:
runs-on: ubuntu-latest
steps:
- name: Checkout the repo
uses: actions/checkout@v3
publish:
runs-on: ubuntu-latest
steps:
- name: Checkout the repo
uses: actions/checkout@v4
- name: Setup Gradle
uses: gradle/gradle-build-action@v3

- name: publish release
run: ./gradlew publishToSonatype closeAndReleaseSonatypeStagingRepository
env:
RELEASE_VERSION: ${{ github.event.inputs.version }}
ORG_GRADLE_PROJECT_sonatypeUsername: ${{ secrets.OSSRH_USERNAME }}
ORG_GRADLE_PROJECT_sonatypePassword: ${{ secrets.OSSRH_PASSWORD }}
ORG_GRADLE_PROJECT_signingKey: ${{ secrets.SIGNING_KEY }}
ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.SIGNING_PASSWORD }}
- name: create release
run: gh release create "v${RELEASE_VERSION}" --generate-notes
env:
RELEASE_VERSION: ${{ github.event.inputs.version }}
GH_TOKEN: ${{ github.token }}

env:
GRADLE_OPTS: -Dorg.gradle.configureondemand=true -Dorg.gradle.parallel=false -Dkotlin.incremental=false -Dorg.gradle.jvmargs="-Xmx3g -XX:MaxPermSize=2048m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8"
- name: publish release
run: ./gradlew publishToSonatype closeAndReleaseSonatypeStagingRepository
env:
RELEASE_VERSION: ${{ github.event.inputs.version }}
ORG_GRADLE_PROJECT_sonatypeUsername: ${{ secrets.OSSRH_USERNAME }}
ORG_GRADLE_PROJECT_sonatypePassword: ${{ secrets.OSSRH_PASSWORD }}
ORG_GRADLE_PROJECT_signingKey: ${{ secrets.SIGNING_KEY }}
ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.SIGNING_PASSWORD }}
- name: create release
run: gh release create "v${RELEASE_VERSION}" --generate-notes
env:
RELEASE_VERSION: ${{ github.event.inputs.version }}
GH_TOKEN: ${{ github.token }}

0 comments on commit 06afd4a

Please sign in to comment.