Skip to content

Commit

Permalink
Add Backport Issue Workflow
Browse files Browse the repository at this point in the history
* Fix workflows according to the repository renaming
* Move utility scripts into the `utils` directory
  • Loading branch information
artembilan committed Nov 19, 2023
1 parent 070fd9e commit 7c6a707
Show file tree
Hide file tree
Showing 13 changed files with 66 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/spring-artifactory-gradle-snapshot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/spring-artifactory-promote-central.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
24 changes: 24 additions & 0 deletions .github/workflows/spring-backport-issue.yml
Original file line number Diff line number Diff line change
@@ -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"
22 changes: 15 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand All @@ -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

Expand All @@ -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.

Expand All @@ -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.
Expand All @@ -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

Expand Down
16 changes: 16 additions & 0 deletions samples/backport-issue.yml
Original file line number Diff line number Diff line change
@@ -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 }}
2 changes: 1 addition & 1 deletion samples/ci-snapshot-gradle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion samples/ci-snapshot-maven.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
2 changes: 1 addition & 1 deletion samples/pr-build-gradle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion samples/pr-build-maven.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion samples/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
File renamed without changes.
File renamed without changes.

0 comments on commit 7c6a707

Please sign in to comment.