Skip to content

Commit

Permalink
build: update GitHub actions to use latest versions (main)
Browse files Browse the repository at this point in the history
- Update setup-java, cache, checkout and upload-artifact actions
- Remove test job and move release job to depend on build job
- Add distribution, GH_URL, MAVEN_USERNAME and MAVEN_PASSWORD env variables
- Update Node.js version to 20.x
  • Loading branch information
GeorgeV220 committed Feb 16, 2024
1 parent 184f485 commit 1c2d02b
Showing 1 changed file with 19 additions and 57 deletions.
76 changes: 19 additions & 57 deletions .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: Build
on: [push]
on: [ push ]
jobs:
build:

Expand All @@ -11,18 +11,19 @@ jobs:

steps:
- name: Set up JDK 17
uses: actions/setup-java@v1
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: 17

- name: Cache Gradle
id: cache-gradle
uses: actions/cache@v1
uses: actions/cache@v3
with:
path: ~/.gradle
key: ${{ runner.os }}-gradle

- uses: actions/checkout@v1
- uses: actions/checkout@v4

- name: Grant execute permission to gradlew
run: chmod +x gradlew
Expand All @@ -31,80 +32,41 @@ jobs:
run: ./gradlew build shadowJar -x test
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_URL: "https://api.github.com/"
MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }}

- name: Upload build artifacts
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
with:
path: "**/build/libs"

test:

runs-on: ubuntu-latest

steps:
- name: Set up JDK 17
uses: actions/setup-java@v1
with:
java-version: 17

- name: Cache Gradle
id: cache-gradle
uses: actions/cache@v1
with:
path: ~/.gradle
key: ${{ runner.os }}-gradle

- uses: actions/checkout@v1

- name: Grant execute permission to gradlew
run: chmod +x gradlew

- name: Test
run: ./gradlew test
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Create Coverage
run: ./gradlew jacocoTestReport
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Upload CodeCov Report
uses: codecov/codecov-action@v1
with:
file: "**/build/reports/jacoco/**/*.xml"

- name: Publish Unit Test Results
uses: EnricoMi/publish-unit-test-result-action@v1.24
if: always()
with:
files: "**/build/test-results/**/*.xml"

release:
needs: [build, test]
if: github.ref == 'refs/heads/master' || 'refs/heads/beta' || github.ref == 'refs/heads/alpha'
needs: [ build ]
if: github.ref == 'refs/heads/main' || 'refs/heads/beta' || github.ref == 'refs/heads/alpha'

runs-on: ubuntu-latest

steps:
- name: Set up JDK 17
uses: actions/setup-java@v1
uses: actions/setup-java@v4
with:
java-version: 17
distribution: 'temurin'
java-version: '17'

- name: Set up Node.js v18.x
uses: actions/setup-node@v1
- name: Set up Node.js v20.x
uses: actions/setup-node@v4
with:
node-version: "18.x"
node-version: "20.x"

- name: Cache Gradle
id: cache-gradle
uses: actions/cache@v1
uses: actions/cache@v3
with:
path: ~/.gradle
key: ${{ runner.os }}-gradle

- uses: actions/checkout@v1
- uses: actions/checkout@v4

- name: Grant execute permission for gradlew
run: chmod +x gradlew
Expand Down

0 comments on commit 1c2d02b

Please sign in to comment.