Skip to content

Commit 83d52b7

Browse files
authored
[Infra] Update GitHub Actions workflows (#32)
This commit refactors the GitHub Actions workflows to improve clarity and efficiency. Key changes include: - Renaming workflow files and their `name` properties for better readability (e.g., `ci.yml` to `build-and-test.yml`). - Upgrading `actions/checkout` to `v6` and `actions/setup-java` to `v5`. - Replacing manual Gradle caching and permission setup with the official `gradle/actions/setup-gradle@v5` action.
1 parent 6d37ba0 commit 83d52b7

3 files changed

Lines changed: 25 additions & 28 deletions

File tree

Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# This workflow builds the project on every push and pull request to the main branch
22

3-
name: AutoMapper CI
3+
name: 'Build and Test'
44

55
on:
66
push:
@@ -15,34 +15,24 @@ jobs:
1515
steps:
1616
# Checks out the repository code so the workflow can access it
1717
- name: Checkout repository
18-
uses: actions/checkout@v4
18+
uses: actions/checkout@v6
1919

2020
# Sets up the specified Java version required by the project
21-
- name: Set up JDK 21
22-
uses: actions/setup-java@v4
21+
- name: Setup JDK 21
22+
uses: actions/setup-java@v5
2323
with:
2424
java-version: '21'
2525
distribution: 'temurin'
2626

27-
# Caches Gradle dependencies to speed up subsequent builds
28-
- name: Cache Gradle packages
29-
uses: actions/cache@v4
30-
with:
31-
path: |
32-
~/.gradle/caches
33-
~/.gradle/wrapper
34-
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
35-
restore-keys: |
36-
${{ runner.os }}-gradle-
37-
38-
# Grants execute permission to the Gradle wrapper script
39-
- name: Grant execute permission for gradlew
40-
run: chmod +x ./gradlew
27+
# Sets up the Gradle for the project
28+
- name: Setup Gradle
29+
uses: gradle/actions/setup-gradle@v5
4130

4231
# Runs the main check task to compile, test, and verify the project
4332
- name: Run Tests & Quality Checks
4433
run: ./gradlew check
4534

4635
# Gradle Daemon Cleanup
4736
- name: Gradle Daemon Cleanup
37+
if: always()
4838
run: ./gradlew --stop
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
# This workflow prepares a new release by creating a pull request from 'develop' to 'main'
1+
# This workflow prepares a new release by creating a pull request from a new release branch to 'main'
22

3-
name: AutoMapper Prepare Release
3+
name: 'Release: Prepare PR'
44

55
on:
66
# Allows this workflow to be triggered manually from the Actions tab
@@ -19,7 +19,7 @@ jobs:
1919
steps:
2020
# Checks out the 'main' branch to get the latest changes
2121
- name: Checkout main branch
22-
uses: actions/checkout@v4
22+
uses: actions/checkout@v6
2323
with:
2424
ref: 'main'
2525

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# This workflow creates a tag, publishes to Maven Central, and creates a GitHub Release
22

3-
name: AutoMapper Release and Publish
3+
name: 'Release: Publish'
44

55
on:
66
push:
@@ -17,7 +17,7 @@ jobs:
1717
steps:
1818
# Checks out the repository with full history to allow branch switching
1919
- name: Checkout repository
20-
uses: actions/checkout@v4
20+
uses: actions/checkout@v6
2121
with:
2222
fetch-depth: 0
2323

@@ -38,15 +38,17 @@ jobs:
3838
git push origin "${{ steps.get_version.outputs.version }}"
3939
4040
# Sets up the specified Java version
41-
- name: Set up JDK 21
42-
uses: actions/setup-java@v4
41+
- name: Setup JDK 21
42+
uses: actions/setup-java@v5
4343
with:
4444
java-version: '21'
4545
distribution: 'temurin'
4646

47-
# Grants execute permission to the Gradle wrapper script
48-
- name: Grant execute permission for gradlew
49-
run: chmod +x ./gradlew
47+
# Sets up the Gradle for the project
48+
- name: Setup Gradle
49+
uses: gradle/actions/setup-gradle@v5
50+
with:
51+
cache-disabled: true
5052

5153
# Publishes the library artifacts to Maven Central
5254
- name: Publish Artifacts to Maven Central
@@ -65,3 +67,8 @@ jobs:
6567
tag: '${{ steps.get_version.outputs.version }}'
6668
name: '${{ steps.get_version.outputs.version }}'
6769
generateReleaseNotes: true
70+
71+
# Gradle Daemon Cleanup
72+
- name: Gradle Daemon Cleanup
73+
if: always()
74+
run: ./gradlew --stop

0 commit comments

Comments
 (0)