|
| 1 | +name: Check Against Latest Versions of IDEA |
| 2 | + |
| 3 | +on: |
| 4 | + schedule: |
| 5 | + - cron: '35 14 * * 5' # Every Friday 14:35 UTC |
| 6 | + workflow_dispatch: |
| 7 | + inputs: |
| 8 | + update_repo: |
| 9 | + description: 'Push updated files to repository' |
| 10 | + default: false |
| 11 | + type: boolean |
| 12 | + |
| 13 | +jobs: |
| 14 | + update-products-releases: |
| 15 | + |
| 16 | + name: Check for New Product Releases of IDEA |
| 17 | + runs-on: ubuntu-latest |
| 18 | + outputs: |
| 19 | + artifact-id: ${{ steps.upload.outputs.artifact-id }} |
| 20 | + products-releases: ${{ steps.get-new-products-releases.outputs.products-releases }} |
| 21 | + has-changed: ${{ steps.diff.outputs.has-changes }} |
| 22 | + |
| 23 | + steps: |
| 24 | + # Setup environment |
| 25 | + - name: Checkout repository |
| 26 | + uses: actions/checkout@v4 |
| 27 | + - name: Set up build tools |
| 28 | + uses: ./.github/actions/setup-tools |
| 29 | + with: |
| 30 | + publish-caches: true |
| 31 | + # Update product releases (gradle/productsReleases.txt) |
| 32 | + - name: Update product releases |
| 33 | + run: ./gradlew --stacktrace updateProductsReleases |
| 34 | + # Prepare job output |
| 35 | + - name: Add resolved product releases to job summary |
| 36 | + run: | |
| 37 | + cat << EOF >> "$GITHUB_STEP_SUMMARY" |
| 38 | + ### Product Releases |
| 39 | +
|
| 40 | + \`\`\` |
| 41 | + $(cat gradle/productsReleases.txt) |
| 42 | + \`\`\` |
| 43 | +
|
| 44 | + EOF |
| 45 | + - name: Check diff |
| 46 | + id: diff |
| 47 | + run: | |
| 48 | + diff_text=$(git diff) |
| 49 | + if [ -z "$diff_text" ]; then |
| 50 | + echo "has-changes=" >> "$GITHUB_OUTPUT" |
| 51 | + diff_text='No changes. File at `gradle/productsReleases.txt` is up-to-date.' |
| 52 | + else |
| 53 | + echo "has-changes=true" >> "$GITHUB_OUTPUT" |
| 54 | + diff_text=$'```diff\n'"$diff_text"$'\n```' |
| 55 | + fi |
| 56 | +
|
| 57 | + cat << EOF >> "$GITHUB_STEP_SUMMARY" |
| 58 | + ### Difference |
| 59 | +
|
| 60 | + ${diff_text} |
| 61 | +
|
| 62 | + ### Gradle Summary |
| 63 | +
|
| 64 | + EOF |
| 65 | + - name: Read productsReleases.txt for compatibility testing matrix |
| 66 | + id: get-new-products-releases |
| 67 | + run: echo "products-releases=$(jq -Rnc '[inputs]' < gradle/productsReleases.txt)" >> "$GITHUB_OUTPUT" |
| 68 | + # Upload new product releases |
| 69 | + - name: Upload new product releases |
| 70 | + id: upload |
| 71 | + uses: actions/upload-artifact@v4 |
| 72 | + with: |
| 73 | + name: products-releases |
| 74 | + path: gradle/productsReleases.txt |
| 75 | + if-no-files-found: error |
| 76 | + # Build the project to populate the build caches, and |
| 77 | + # to verify that the build is working. |
| 78 | + - name: Build project |
| 79 | + run: ./gradlew --stacktrace assemble buildPlugin verifyPluginStructure check |
| 80 | + |
| 81 | + check-compatibility: |
| 82 | + |
| 83 | + uses: ./.github/workflows/check-compatibility.yml |
| 84 | + needs: update-products-releases |
| 85 | + with: |
| 86 | + products_releases: ${{ needs.update-products-releases.outputs.products-releases }} |
| 87 | + |
| 88 | + push-to-repository: |
| 89 | + |
| 90 | + name: Push Updated Files To Repository |
| 91 | + runs-on: ubuntu-latest |
| 92 | + needs: [ update-products-releases, check-compatibility ] |
| 93 | + if: ${{ inputs.update_repo && needs.update-products-releases.outputs.has-changed }} |
| 94 | + |
| 95 | + steps: |
| 96 | + - name: Checkout repository |
| 97 | + uses: actions/checkout@v4 |
| 98 | + - name: Download new product releases |
| 99 | + uses: actions/download-artifact@v4 |
| 100 | + with: |
| 101 | + artifact-ids: ${{ needs.update-products-releases.outputs.artifact-id }} |
| 102 | + path: gradle/ |
| 103 | + merge-multiple: true |
| 104 | + - name: Commit and push changes |
| 105 | + uses: ./.github/actions/commit-and-push |
| 106 | + with: |
| 107 | + message: Update IDEA releases for testing compatibility |
0 commit comments