Skip to content

Commit 97bd68a

Browse files
authored
GitHub action for building with Gradle
1 parent 861f388 commit 97bd68a

File tree

1 file changed

+73
-0
lines changed

1 file changed

+73
-0
lines changed

.github/workflows/gradle.yml

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
# This workflow uses actions that are not certified by GitHub.
2+
# They are provided by a third-party and are governed by
3+
# separate terms of service, privacy policy, and support
4+
# documentation.
5+
# This workflow will build a Java project with Gradle and cache/restore any dependencies to improve the workflow execution time
6+
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-gradle
7+
8+
name: Java CI with Gradle
9+
10+
on:
11+
push:
12+
branches:
13+
- main
14+
pull_request:
15+
types:
16+
- opened
17+
- synchronize
18+
- reopened
19+
branches:
20+
- main
21+
22+
jobs:
23+
build:
24+
25+
runs-on: ubuntu-latest
26+
permissions:
27+
contents: read
28+
29+
steps:
30+
- uses: actions/checkout@v4
31+
- name: Set up JDK 17
32+
uses: actions/setup-java@v4
33+
with:
34+
java-version: '17'
35+
distribution: 'temurin'
36+
37+
# Configure Gradle for optimal use in GiHub Actions, including caching of downloaded dependencies.
38+
# See: https://github.com/gradle/actions/blob/main/setup-gradle/README.md
39+
- name: Setup Gradle
40+
uses: gradle/actions/setup-gradle@ec92e829475ac0c2315ea8f9eced72db85bb337a # v3.0.0
41+
42+
- name: Build with Gradle Wrapper
43+
run: ./gradlew build
44+
45+
# NOTE: The Gradle Wrapper is the default and recommended way to run Gradle (https://docs.gradle.org/current/userguide/gradle_wrapper.html).
46+
# If your project does not have the Gradle Wrapper configured, you can use the following configuration to run Gradle with a specified version.
47+
#
48+
# - name: Setup Gradle
49+
# uses: gradle/actions/setup-gradle@ec92e829475ac0c2315ea8f9eced72db85bb337a # v3.0.0
50+
# with:
51+
# gradle-version: '8.5'
52+
#
53+
# - name: Build with Gradle 8.5
54+
# run: gradle build
55+
56+
dependency-submission:
57+
58+
runs-on: ubuntu-latest
59+
permissions:
60+
contents: write
61+
62+
steps:
63+
- uses: actions/checkout@v4
64+
- name: Set up JDK 17
65+
uses: actions/setup-java@v4
66+
with:
67+
java-version: '17'
68+
distribution: 'temurin'
69+
70+
# Generates and submits a dependency graph, enabling Dependabot Alerts for all project dependencies.
71+
# See: https://github.com/gradle/actions/blob/main/dependency-submission/README.md
72+
- name: Generate and submit dependency graph
73+
uses: gradle/actions/dependency-submission@ec92e829475ac0c2315ea8f9eced72db85bb337a # v3.0.0

0 commit comments

Comments
 (0)