Skip to content

Commit

Permalink
chore: update github actions
Browse files Browse the repository at this point in the history
  • Loading branch information
miurahr committed Sep 14, 2024
1 parent 1c324c3 commit fd95876
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 28 deletions.
22 changes: 7 additions & 15 deletions .github/workflows/build-release-and-upload.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,28 +11,20 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- uses: actions/setup-java@v3
uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '8'
java-version: '17'
- name: Get the version
id: get_version
run: |
REV_COUNT=`git rev-list --count HEAD`
echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\/v/}
- uses: gradle/gradle-build-action@v2
- run: ./gradlew check
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release v${{ steps.get_version.outputs.VERSION }}
draft: false
prerelease: false
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
- name: Build with Gradle
run: ./gradlew build
- name: Publish package to OSSRH
run: ./gradlew publishToSonatype
env:
Expand Down
41 changes: 30 additions & 11 deletions .github/workflows/gradle-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,36 @@ jobs:
gradle-check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
- name: Checkout sources
uses: actions/checkout@v4
- name: setup xvfb environment
run: sudo apt-get install -f -q xvfb libsm-dev libxrender1 libxext-dev libxtst-dev libxcb1-dev fonts-dejavu xfonts-base xfonts-scalable
- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '8'
- uses: kiancross/checkstyle-annotations-action@v1
- uses: eskatos/gradle-command-action@v2
name: gradle check
java-version: 17
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
with:
arguments: check
- name: publish coveralls
run: ./gradlew coveralls
env:
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
build-scan-publish: true
build-scan-terms-of-service-url: https://gradle.com/terms-of-service
build-scan-terms-of-service-agree: yes
- name: Run gradle build
run: xvfb-run -a --server-args='-screen 0, 1024x768x24' ./gradlew -PenvIsCi=true check
id: gradle
- name: "Add Build Scan URL as PR comment"
uses: actions/github-script@v7
if: github.event_name == 'pull_request' && failure()
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: `❌ ${{ github.workflow }} **failed**.
Please look a Gradle Scan page for details:
${{ steps.gradle.outputs.build-scan-url }}`
})
9 changes: 7 additions & 2 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,13 @@ nexusPublishing.repositories {
stagingProfileId = "15818299f2c2bb"
nexusUrl.set(uri("https://s01.oss.sonatype.org/service/local/"))
snapshotRepositoryUrl.set(uri("https://s01.oss.sonatype.org/content/repositories/snapshots/"))
username.set(ossrhUsername)
password.set(ossrhPassword)
if (ossrhUsername != null && ossrhPassword != null) {
username.set(ossrhUsername)
password.set(ossrhPassword)
} else {
username.set(System.getenv("SONATYPE_USER"))
password.set(System.getenv("SONATYPE_PASSWORD"))
}
}
}

Expand Down

0 comments on commit fd95876

Please sign in to comment.