diff --git a/.github/actions/setup-tools/action.yml b/.github/actions/setup-tools/action.yml new file mode 100644 index 00000000..685c5e32 --- /dev/null +++ b/.github/actions/setup-tools/action.yml @@ -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' }} diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 50cb3805..83b9fb3e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -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 @@ -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 diff --git a/.github/workflows/bump-version.yml b/.github/workflows/bump-version.yml index a27d79fc..1d8b2049 100644 --- a/.github/workflows/bump-version.yml +++ b/.github/workflows/bump-version.yml @@ -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' diff --git a/.github/workflows/publish-to-jetbrains.yml b/.github/workflows/publish-to-jetbrains.yml index 33b640e7..1955214b 100644 --- a/.github/workflows/publish-to-jetbrains.yml +++ b/.github/workflows/publish-to-jetbrains.yml @@ -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