From 7c6a707cafaea4de01c1167602c3c94f83f78c1b Mon Sep 17 00:00:00 2001 From: Artem Bilan Date: Sun, 19 Nov 2023 11:44:52 -0500 Subject: [PATCH] Add Backport Issue Workflow * Fix workflows according to the repository renaming * Move utility scripts into the `utils` directory --- ...ing-artifactory-gradle-release-staging.yml | 4 ++-- .../spring-artifactory-gradle-snapshot.yml | 4 ++-- .../spring-artifactory-promote-central.yml | 4 ++-- .github/workflows/spring-backport-issue.yml | 24 +++++++++++++++++++ README.md | 22 +++++++++++------ samples/backport-issue.yml | 16 +++++++++++++ samples/ci-snapshot-gradle.yml | 2 +- samples/ci-snapshot-maven.yml | 2 +- samples/pr-build-gradle.yml | 2 +- samples/pr-build-maven.yml | 2 +- samples/release.yml | 2 +- .../release-files-spec.json | 0 .../spring-project-init.gradle | 0 13 files changed, 66 insertions(+), 18 deletions(-) create mode 100644 .github/workflows/spring-backport-issue.yml create mode 100644 samples/backport-issue.yml rename release-files-spec.json => utils/release-files-spec.json (100%) rename spring-project-init.gradle => utils/spring-project-init.gradle (100%) diff --git a/.github/workflows/spring-artifactory-gradle-release-staging.yml b/.github/workflows/spring-artifactory-gradle-release-staging.yml index f938eea..92b2a0b 100644 --- a/.github/workflows/spring-artifactory-gradle-release-staging.yml +++ b/.github/workflows/spring-artifactory-gradle-release-staging.yml @@ -58,12 +58,12 @@ jobs: - name: Checkout Common Repo uses: actions/checkout@v4 with: - repository: artembilan/spring-messaging-build-tools + repository: artembilan/spring-github-workflows path: build show-progress: false - name: Copy the spring-project-init.gradle - run: rsync build/spring-project-init.gradle ~/.gradle/init.d/ + run: rsync build/utils/spring-project-init.gradle ~/.gradle/init.d/ - uses: jfrog/setup-jfrog-cli@v3 diff --git a/.github/workflows/spring-artifactory-gradle-snapshot.yml b/.github/workflows/spring-artifactory-gradle-snapshot.yml index 4bdf4d4..31cdca6 100644 --- a/.github/workflows/spring-artifactory-gradle-snapshot.yml +++ b/.github/workflows/spring-artifactory-gradle-snapshot.yml @@ -40,12 +40,12 @@ jobs: - name: Checkout Common Repo uses: actions/checkout@v4 with: - repository: artembilan/spring-messaging-build-tools + repository: artembilan/spring-github-workflows path: build show-progress: false - name: Copy the spring-project-init.gradle - run: rsync build/spring-project-init.gradle ~/.gradle/init.d/ + run: rsync build/utils/spring-project-init.gradle ~/.gradle/init.d/ - uses: jfrog/setup-jfrog-cli@v3 diff --git a/.github/workflows/spring-artifactory-promote-central.yml b/.github/workflows/spring-artifactory-promote-central.yml index 4dbb72f..3af94c0 100644 --- a/.github/workflows/spring-artifactory-promote-central.yml +++ b/.github/workflows/spring-artifactory-promote-central.yml @@ -38,7 +38,7 @@ jobs: - uses: actions/checkout@v4 with: - repository: artembilan/spring-messaging-build-tools + repository: artembilan/spring-github-workflows show-progress: false - uses: jfrog/setup-jfrog-cli@v3 @@ -50,7 +50,7 @@ jobs: - name: Download Release Files run: | jfrog rt download \ - --spec release-files-spec.json \ + --spec utils/release-files-spec.json \ --spec-vars "buildname=${{ inputs.buildName }};buildnumber=${{ inputs.buildNumber }}" # Create checksums, signatures and create staging repo on central and upload diff --git a/.github/workflows/spring-backport-issue.yml b/.github/workflows/spring-backport-issue.yml new file mode 100644 index 0000000..1af0fe7 --- /dev/null +++ b/.github/workflows/spring-backport-issue.yml @@ -0,0 +1,24 @@ +name: Backport GH Issue + +on: + workflow_call: + secrets: + GH_ACTIONS_REPO_TOKEN: + required: true + +jobs: + build: + runs-on: ubuntu-latest + steps: + + - uses: actions/checkout@v4 + with: + show-progress: false + + - name: Create Backport Issue + env: + GITHUB_TOKEN: ${{ secrets.GH_ACTIONS_REPO_TOKEN }} + GITHUB_EVENT: ${{ toJSON(github.event) }} + run: | + wget https://github.com/spring-io/backport-bot/releases/download/latest/backport-bot-0.0.1-SNAPSHOT.jar + java -jar backport-bot-0.0.1-SNAPSHOT.jar --github.accessToken="$GITHUB_TOKEN" --github.event_name "$GITHUB_EVENT_NAME" --github.event "$GITHUB_EVENT" diff --git a/README.md b/README.md index ea26202..41efa8a 100644 --- a/README.md +++ b/README.md @@ -33,10 +33,10 @@ They perform Gradle `check` task and Maven `verify` goal, respectively. The caller workflow is as simple as follows. #### Gradle Pull Request caller workflow: -https://github.com/artembilan/spring-messaging-build-tools/blob/decee2963c926c34f1f52bf373a3bc1dc09f1724/samples/pr-build-gradle.yml#L1-L10 +https://github.com/artembilan/spring-github-workflows/blob/decee2963c926c34f1f52bf373a3bc1dc09f1724/samples/pr-build-gradle.yml#L1-L10 #### Maven Pull Request caller workflow: -https://github.com/artembilan/spring-messaging-build-tools/blob/decee2963c926c34f1f52bf373a3bc1dc09f1724/samples/pr-build-maven.yml#L1-L10 +https://github.com/artembilan/spring-github-workflows/blob/decee2963c926c34f1f52bf373a3bc1dc09f1724/samples/pr-build-maven.yml#L1-L10 You can add more branches to react for pull request events. @@ -45,10 +45,10 @@ They use JFrog CLI action to be able to publish artifacts into `libs-snapshot-lo The Gradle workflow can be supplied with Gradle Enterprise secrets. #### Gradle SNAPSHOT caller workflow: -https://github.com/artembilan/spring-messaging-build-tools/blob/decee2963c926c34f1f52bf373a3bc1dc09f1724/samples/ci-snapshot-gradle.yml#L1-L18 +https://github.com/artembilan/spring-github-workflows/blob/decee2963c926c34f1f52bf373a3bc1dc09f1724/samples/ci-snapshot-gradle.yml#L1-L18 #### Maven SNAPSHOT caller workflow: -https://github.com/artembilan/spring-messaging-build-tools/blob/decee2963c926c34f1f52bf373a3bc1dc09f1724/samples/ci-snapshot-maven.yml#L1-L13 +https://github.com/artembilan/spring-github-workflows/blob/decee2963c926c34f1f52bf373a3bc1dc09f1724/samples/ci-snapshot-maven.yml#L1-L13 ## Release Workflow @@ -75,7 +75,7 @@ The `gh release create` command is performed on a tag for just released version. And in the end the milestone is closed and specific Slack channel is notified about release (if `SPRING_RELEASE_SLACK_WEBHOOK_URL` secret is present in the repository). #### Example of Release caller workflow: -https://github.com/artembilan/spring-messaging-build-tools/blob/decee2963c926c34f1f52bf373a3bc1dc09f1724/samples/release.yml#L1-L25 +https://github.com/artembilan/spring-github-workflows/blob/decee2963c926c34f1f52bf373a3bc1dc09f1724/samples/release.yml#L1-L25 Such a workflow must be on every branch which is supposed to be released via GitHub actions. @@ -87,7 +87,7 @@ In the end you just need to go to the `Actions` tab on your project, press `Run Such a release workflow can also be scheduled (`cron`, fo example) against branches matrix. #### Scheduler workflow example: -https://github.com/artembilan/spring-messaging-build-tools/blob/3231d7b9b4fcd05afff3db32d34aa37565535ccb/samples/schedule-releases.yml#L1-L19 +https://github.com/artembilan/spring-github-workflows/blob/3231d7b9b4fcd05afff3db32d34aa37565535ccb/samples/schedule-releases.yml#L1-L19 > **Warning** > The [spring-artifactory-release.yml](.github/workflows/spring-artifactory-release.yml) already uses 3 of 4 levels of nested reusable workflows. @@ -101,7 +101,15 @@ For example, [Spring Integration for AWS](https://github.com/spring-projects/spr Other projects may check out their samples repository and setup release version to perform smoke tests against just staged artifacts. #### Verify staged workflow sample: -https://github.com/artembilan/spring-messaging-build-tools/blob/dbd138bf504abec593bdadd882cc7a450d8eb0df/samples/verify-staged-artifacts.yml#L1-L28 +https://github.com/artembilan/spring-github-workflows/blob/dbd138bf504abec593bdadd882cc7a450d8eb0df/samples/verify-staged-artifacts.yml#L1-L28 + +## Backport GitHub Issue Workflow + +The [spring-backport-issue.yml](.github/workflows/spring-backport-issue.yml) uses [Spring Backport Bot](https://github.com/spring-io/backport-bot) to create a back-port issue according to the event configured in a caller workflow. +See its documentation for labeling convention and respective GitHub events for calling this workflow. + +#### Backport Issue caller workflow example: + ## Gradle and Artifactory diff --git a/samples/backport-issue.yml b/samples/backport-issue.yml new file mode 100644 index 0000000..497b50a --- /dev/null +++ b/samples/backport-issue.yml @@ -0,0 +1,16 @@ +name: Backport Issue + +on: + issues: + types: [labeled] + pull_request: + types: [labeled] + push: + branches: + - '*.x' + +jobs: + build_snapshot: + uses: artembilan/spring-github-workflows/.github/workflows/spring-backport-issue.yml@main + secrets: + GH_ACTIONS_REPO_TOKEN: ${{ secrets.GH_ACTIONS_REPO_TOKEN }} \ No newline at end of file diff --git a/samples/ci-snapshot-gradle.yml b/samples/ci-snapshot-gradle.yml index 2eebc78..379efd5 100644 --- a/samples/ci-snapshot-gradle.yml +++ b/samples/ci-snapshot-gradle.yml @@ -8,7 +8,7 @@ on: jobs: build-snapshot: - uses: artembilan/spring-messaging-build-tools/.github/workflows/spring-artifactory-gradle-snapshot.yml@main + uses: artembilan/spring-github-workflows/.github/workflows/spring-artifactory-gradle-snapshot.yml@main with: gradleTasks: dist secrets: diff --git a/samples/ci-snapshot-maven.yml b/samples/ci-snapshot-maven.yml index a02c8a9..2777abd 100644 --- a/samples/ci-snapshot-maven.yml +++ b/samples/ci-snapshot-maven.yml @@ -8,6 +8,6 @@ on: jobs: build_snapshot: - uses: artembilan/spring-messaging-build-tools/.github/workflows/spring-artifactory-maven-snapshot.yml@main + uses: artembilan/spring-github-workflows/.github/workflows/spring-artifactory-maven-snapshot.yml@main secrets: JF_ARTIFACTORY_SPRING: ${{ secrets.JF_ARTIFACTORY_SPRING }} \ No newline at end of file diff --git a/samples/pr-build-gradle.yml b/samples/pr-build-gradle.yml index d5b1363..246f6a7 100644 --- a/samples/pr-build-gradle.yml +++ b/samples/pr-build-gradle.yml @@ -7,4 +7,4 @@ on: jobs: build-pull-request: - uses: artembilan/spring-messaging-build-tools/.github/workflows/spring-gradle-pull-request-build.yml@main + uses: artembilan/spring-github-workflows/.github/workflows/spring-gradle-pull-request-build.yml@main diff --git a/samples/pr-build-maven.yml b/samples/pr-build-maven.yml index 5377afb..db18266 100644 --- a/samples/pr-build-maven.yml +++ b/samples/pr-build-maven.yml @@ -7,4 +7,4 @@ on: jobs: build: - uses: artembilan/spring-messaging-build-tools/.github/workflows/spring-maven-pull-request-build.yml@main + uses: artembilan/spring-github-workflows/.github/workflows/spring-maven-pull-request-build.yml@main diff --git a/samples/release.yml b/samples/release.yml index caf7737..32dccf2 100644 --- a/samples/release.yml +++ b/samples/release.yml @@ -7,7 +7,7 @@ run-name: Release current version for branch ${{ github.ref_name }} jobs: release: - uses: artembilan/spring-messaging-build-tools/.github/workflows/spring-artifactory-release.yml@main + uses: artembilan/spring-github-workflows/.github/workflows/spring-artifactory-release.yml@main with: buildToolArgs: dist secrets: diff --git a/release-files-spec.json b/utils/release-files-spec.json similarity index 100% rename from release-files-spec.json rename to utils/release-files-spec.json diff --git a/spring-project-init.gradle b/utils/spring-project-init.gradle similarity index 100% rename from spring-project-init.gradle rename to utils/spring-project-init.gradle