From 9bfeac2bb3c5d4369f6f6bca4925ff65116a8ff0 Mon Sep 17 00:00:00 2001 From: Luke Bemish Date: Mon, 9 Dec 2024 21:32:36 -0600 Subject: [PATCH] Updae actions --- .github/workflows/build_pr.yml | 4 ++-- .github/workflows/publish_pr.yml | 13 +++++++------ .github/workflows/release.yml | 14 +++++++------- .github/workflows/snapshot.yml | 4 ++-- settings.gradle | 2 +- 5 files changed, 19 insertions(+), 18 deletions(-) diff --git a/.github/workflows/build_pr.yml b/.github/workflows/build_pr.yml index 32ce651..e2ef9bc 100644 --- a/.github/workflows/build_pr.yml +++ b/.github/workflows/build_pr.yml @@ -17,7 +17,7 @@ }, { "name": "Validate Gradle Wrapper", - "uses": "gradle/actions/wrapper-validation@v3" + "uses": "gradle/actions/wrapper-validation@v4" }, { "with": { @@ -34,7 +34,7 @@ "gradle-home-cache-cleanup": true }, "name": "Setup Gradle", - "uses": "gradle/actions/setup-gradle@v3" + "uses": "gradle/actions/setup-gradle@v4" }, { "name": "Build", diff --git a/.github/workflows/publish_pr.yml b/.github/workflows/publish_pr.yml index 414e299..2f29583 100644 --- a/.github/workflows/publish_pr.yml +++ b/.github/workflows/publish_pr.yml @@ -17,10 +17,11 @@ }, { "with": { - "script": "const pull_requests = ${{ toJSON(github.event.workflow_run.pull_requests) }};\nif (!pull_requests.length) {\n return core.error(\"This workflow doesn't match any pull requests!\");\n}\nlet allArtifacts = await github.rest.actions.listWorkflowRunArtifacts({\n owner: context.repo.owner,\n repo: context.repo.repo,\n run_id: context.payload.workflow_run.id,\n});\nlet matchArtifact = allArtifacts.data.artifacts.filter((artifact) => {\n return artifact.name == \"artifacts\"\n})[0];\nlet download = await github.rest.actions.downloadArtifact({\n owner: context.repo.owner,\n repo: context.repo.repo,\n artifact_id: matchArtifact.id,\n archive_format: 'zip',\n});\nlet fs = require('fs');\nfs.writeFileSync(`${process.env.GITHUB_WORKSPACE}/repo.zip`, Buffer.from(download.data));" + "script": "const response = await github.rest.search.issuesAndPullRequests({\n q: 'repo:${{ github.repository }} is:pr sha:${{ github.event.workflow_run.head_sha }}',\n per_page: 1,\n})\nconst items = response.data.items\nif (items.length < 1) {\n console.error('No PRs found')\n return\n}\nconst pullRequestNumber = items[0].number\nlet allArtifacts = await github.rest.actions.listWorkflowRunArtifacts({\n owner: context.repo.owner,\n repo: context.repo.repo,\n run_id: context.payload.workflow_run.id,\n});\nlet matchArtifact = allArtifacts.data.artifacts.filter((artifact) => {\n return artifact.name == \"artifacts\"\n})[0];\nlet download = await github.rest.actions.downloadArtifact({\n owner: context.repo.owner,\n repo: context.repo.repo,\n artifact_id: matchArtifact.id,\n archive_format: 'zip',\n});\nlet fs = require('fs');\nfs.writeFileSync(`${process.env.GITHUB_WORKSPACE}/repo.zip`, Buffer.from(download.data));\nreturn pullRequestNumber;" }, "name": "Download Artifacts", - "uses": "actions/github-script@v7" + "uses": "actions/github-script@v7", + "id": "download_artifacts" }, { "name": "Unpack Artifacts", @@ -33,7 +34,7 @@ "MAVEN_USER": "github", "MAVEN_PASSWORD": "${{ secrets.PR_MAVEN_PASSWORD }}", "MAVEN_URL": "https://maven.lukebemish.dev/pullrequests/", - "ALLOWED_VERSION": "*-pr${{ github.event.workflow_run.pull_requests[0].number }}", + "ALLOWED_VERSION": "*-pr${{ steps.download_artifacts.outputs.result }}", "ALLOWED_PATHS": "dev/lukebemish/immaculate,dev/lukebemish/immaculate/*,dev/lukebemish/immaculate/wrapper/*" } } @@ -45,11 +46,11 @@ "concurrency": "ci-${{ github.ref }}", "on": { "workflow_run": { - "types": [ - "completed" - ], "workflows": [ "Build PR" + ], + "types": [ + "completed" ] } } diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index e514de7..7eda7f7 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -22,7 +22,7 @@ }, { "name": "Validate Gradle Wrapper", - "uses": "gradle/actions/wrapper-validation@v3" + "uses": "gradle/actions/wrapper-validation@v4" }, { "with": { @@ -38,7 +38,7 @@ "gradle-home-cache-cleanup": true }, "name": "Setup Gradle", - "uses": "gradle/actions/setup-gradle@v3" + "uses": "gradle/actions/setup-gradle@v4" }, { "uses": "fregante/setup-git-user@v2" @@ -83,7 +83,7 @@ }, { "name": "Submit Dependencies", - "uses": "gradle/actions/dependency-submission@v3", + "uses": "gradle/actions/dependency-submission@v4", "env": { "BUILD_CACHE_PASSWORD": "${{ secrets.BUILD_CACHE_PASSWORD }}", "BUILD_CACHE_USER": "${{ secrets.BUILD_CACHE_USER }}", @@ -113,7 +113,7 @@ }, { "name": "Validate Gradle Wrapper", - "uses": "gradle/actions/wrapper-validation@v3" + "uses": "gradle/actions/wrapper-validation@v4" }, { "with": { @@ -130,7 +130,7 @@ "gradle-home-cache-cleanup": true }, "name": "Setup Gradle", - "uses": "gradle/actions/setup-gradle@v3" + "uses": "gradle/actions/setup-gradle@v4" }, { "name": "Publish Central", @@ -172,7 +172,7 @@ }, { "name": "Validate Gradle Wrapper", - "uses": "gradle/actions/wrapper-validation@v3" + "uses": "gradle/actions/wrapper-validation@v4" }, { "with": { @@ -189,7 +189,7 @@ "gradle-home-cache-cleanup": true }, "name": "Setup Gradle", - "uses": "gradle/actions/setup-gradle@v3" + "uses": "gradle/actions/setup-gradle@v4" }, { "name": "Publish Plugins", diff --git a/.github/workflows/snapshot.yml b/.github/workflows/snapshot.yml index 1d7386e..8dac4ab 100644 --- a/.github/workflows/snapshot.yml +++ b/.github/workflows/snapshot.yml @@ -17,7 +17,7 @@ }, { "name": "Validate Gradle Wrapper", - "uses": "gradle/actions/wrapper-validation@v3" + "uses": "gradle/actions/wrapper-validation@v4" }, { "with": { @@ -33,7 +33,7 @@ "gradle-home-cache-cleanup": true }, "name": "Setup Gradle", - "uses": "gradle/actions/setup-gradle@v3" + "uses": "gradle/actions/setup-gradle@v4" }, { "name": "Build", diff --git a/settings.gradle b/settings.gradle index a9ed264..9f28667 100644 --- a/settings.gradle +++ b/settings.gradle @@ -8,7 +8,7 @@ pluginManagement { plugins { id 'dev.lukebemish.conventions' version '0.1.10' id 'io.github.gradle-nexus.publish-plugin' version '2.0.0' apply false - id 'dev.lukebemish.managedversioning' version '1.2.19' apply false + id 'dev.lukebemish.managedversioning' version '1.2.26' apply false } gradle.lifecycle.beforeProject {