Skip to content

Commit

Permalink
Extract tool setup into composite action
Browse files Browse the repository at this point in the history
  • Loading branch information
JojOatXGME committed May 2, 2024
1 parent d43cdd1 commit 46b0bbb
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 36 deletions.
19 changes: 19 additions & 0 deletions .github/actions/setup-tools/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Set up Build Tools
description: Set up and configure Java and Gradle
inputs:
publish-caches:
description: Whether this job shall be used to update the caches
default: 'false'
runs:
using: composite
steps:
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: 17
distribution: temurin
- name: Set up Gradle
uses: gradle/actions/setup-gradle@v3
with:
gradle-home-cache-cleanup: ${{ inputs.publish-caches == 'true' }}
cache-read-only: ${{ inputs.publish-caches != 'true' }}
24 changes: 6 additions & 18 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,10 @@ jobs:
# Setup environment
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v4
- name: Set up build tools
uses: ./.github/actions/setup-tools
with:
java-version: 17
distribution: temurin
- name: Set up Gradle
uses: gradle/actions/setup-gradle@v3
with:
gradle-home-cache-cleanup: true
publish-caches: true
# Collect metadata
- name: Collect metadata for upcoming steps and jobs
id: metadata
Expand Down Expand Up @@ -94,17 +89,10 @@ jobs:
# Setup environment
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: 17
distribution: temurin
- name: Set up Gradle
uses: gradle/actions/setup-gradle@v3
with:
cache-read-only: true
- name: Set up build tools
uses: ./.github/actions/setup-tools
# Setup caches for Plugin Verifier
- name: Setup cache for IntelliJ Plugin Verifier
- name: Set up cache for IntelliJ Plugin Verifier
uses: actions/cache@v4
with:
path: ~/.pluginVerifier/ides
Expand Down
11 changes: 2 additions & 9 deletions .github/workflows/bump-version.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,8 @@ jobs:
# Setup environment
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: 17
distribution: temurin
- name: Set up Gradle
uses: gradle/actions/setup-gradle@v3
with:
cache-read-only: true
- name: Set up build tools
uses: ./.github/actions/setup-tools
# Fail if the release was not triggered from the master branch
- name: Verify branch
if: github.event_name == 'release'
Expand Down
11 changes: 2 additions & 9 deletions .github/workflows/publish-to-jetbrains.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,8 @@ jobs:
# Setup environment
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: 17
distribution: temurin
- name: Set up Gradle
uses: gradle/actions/setup-gradle@v3
with:
cache-read-only: true
- name: Set up build tools
uses: ./.github/actions/setup-tools
# Build and publish
- name: Obtain release notes
uses: actions/github-script@v7
Expand Down

0 comments on commit 46b0bbb

Please sign in to comment.