| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
This project contains reusable GitHub Actions Workflows to build Spring projects with Gradle or Maven.
And provides some other useful utilities to perform from GitHub Actions, such a Dependabot auto-merge, or automatic back-port issue creation.
The workflows are designed for specific tasks and can be reused individually or in combinations in the target projects.
To use these workflows in your project a set of organization secrets must be granted to the repository:
GH_ACTIONS_REPO_TOKEN DEVELOCITY_ACCESS_KEY JF_ARTIFACTORY_SPRING ARTIFACTORY_USERNAME ARTIFACTORY_PASSWORD SPRING_RELEASE_CHAT_WEBHOOK_URL NOTIFICATIONS_CHAT_WEBHOOK_URL CENTRAL_TOKEN_USERNAME CENTRAL_TOKEN_PASSWORD GPG_PASSPHRASE GPG_PRIVATE_KEY
The Develocity secret is optional: mostly not used by Maven, and a Gradle project might not be enrolled for the service.
The SPRING_RELEASE_CHAT_WEBHOOK_URL secret is also optional: probably you don't want to notify Google Space about your release, or it is not available for GitHub organization.
The NOTIFICATIONS_CHAT_WEBHOOK_URL secret is also optional: when set, the CI, SNAPSHOT and cherry-pick workflows send a Google Chat notification whenever their job fails.
As well as CENTRAL_TOKEN_* secrets, since not all releases might go to Maven Central Portal, e.g. private (commercial) repositories only.
The mentioned secrets must be passed explicitly since these reusable workflows might be in a different GitHub org than the target project.
The SNAPSHOT and Release workflows use spring-io/artifactory-deploy-action to publish artifacts into Artifactory.
The spring-gradle-pull-request-build.yml and spring-maven-pull-request-build.yml are straight forward, single job reusable workflows. They perform Gradle check task and Maven verify goal, respectively. The caller workflow is as simple as follows.
spring-github-workflows/samples/pr-build-gradle.yml
Lines 1 to 10 in 29fd75f
spring-github-workflows/samples/pr-build-maven.yml
Lines 1 to 10 in 29fd75f
You can add more branches to react to pull request events.
The SNAPSHOT workflows (spring-artifactory-gradle-snapshot.yml and spring-artifactory-maven-snapshot.yml, respectively) are also that simple. They publish artifacts into libs-snapshot-local (by default) repository. The Gradle workflow can be supplied with Develocity secret.
spring-github-workflows/samples/ci-snapshot-gradle.yml
Lines 1 to 17 in 88d5c5f
spring-github-workflows/samples/ci-snapshot-maven.yml
Lines 1 to 14 in 88d5c5f
Both Gradle and Maven SNAPSHOT build workflow requires ARTIFACTORY_USERNAME & ARTIFACTORY_PASSWORD secretes to authorise spring-io/artifactory-deploy-action. Optionally, all the artifacts can be signed if GPG_PASSPHRASE and GPG_PRIVATE_KEY secrets are provided.
The spring-artifactory-gradle-release.yml (and therefore spring-artifactory-maven-release.yml) workflow is complex enough, has some branching jobs and makes some assumptions and expects particular conditions on your repository:
The logic of this release workflow:
That tag push is itself the trigger for spring-post-release.yml: a separate, push: tags-triggered workflow (not part of the job graph above) which generates release notes using Spring Changelog Generator excluding repository admins from the Contributors section, creates the GitHub release for that tag, closes the milestone, updates the spring.io project page for the newly released version (via the spring-website-project-version-update local action), notifies the configured Google Space (if SPRING_RELEASE_CHAT_WEBHOOK_URL secret is present), and computes/creates the next scheduled milestone. It derives the milestone (and whether it's a hotfix) straight from the pushed tag name, so it reacts identically no matter who pushed the tag - spring-finalize-release.yml above, or some other process (e.g. a release train orchestrator publishing this project's version into the repository). For any release that isn't a hotfix and isn't already end-of-life (including -M/-RC previews), it also merges the pushed release tag back into the corresponding {major}.{minor}.x maintenance branch. Falls back to the repository's default branch if that branch doesn't exist yet - so the tag's commit isn't left stranded unreachable from any branch. Then commits its own next-SNAPSHOT version bump on top, since the tag itself carries no such commit when it was pushed by a release train orchestrator rather than spring-finalize-release.yml. Hotfix branches are excluded: they're one-time-use and never continued from.
Wire it up once per repository, alongside your release caller workflow:
name: Post Release
on:
push:
tags:
- 'v*'
jobs:
post-release:
uses: spring-io/spring-github-workflows/.github/workflows/spring-post-release.yml@main
secrets:
GH_ACTIONS_REPO_TOKEN: ${{ secrets.GH_ACTIONS_REPO_TOKEN }}
SPRING_RELEASE_CHAT_WEBHOOK_URL: ${{ secrets.SPRING_RELEASE_GCHAT_WEBHOOK_URL }}spring-github-workflows/samples/release-with-gradle.yml
Lines 1 to 24 in 88d5c5f
Such a workflow must be on every branch that is supposed to be released via GitHub actions.
The buildToolArgs parameter for this job means extra build tool arguments. For example, the mentioned dist value is a Gradle task in the project. Can be any Maven goal or other command line arguments.
The signing released artifacts is done by the spring-io/artifactory-deploy-action if GPG_PASSPHRASE and GPG_PRIVATE_KEY secrets are provided. In the end, all the artifacts, together with their signatures, are uploaded to the Artifactory according to the respective workflow inputs.
In the end you just need to go to the Actions tab on your project, press Run workflow on your release workflow and choose a branch from a drop-down list to release currently scheduled Milestone against. Such a release workflow can also be scheduled (cron, for example) against branches matrix.
spring-github-workflows/samples/schedule-releases.yml
Lines 1 to 19 in 78b2912
Warning The spring-artifactory-gradle-release.yml (and spring-artifactory-maven-release.yml) already uses 3 of 4 levels of nested reusable workflows. Where the caller workflow is the last one. Therefore don't try to reuse your caller workflow.
The verify-staged job expects an optional verifyStagedWorkflow input (the verify-staged-artifacts.yml, by default) workflow supplied from the target project. For example, Spring Integration for AWS uses jfrog rt download command to verify that released spring-integration-aws-${{ inputs.releaseVersion }}.jar is valid. Other projects may check out their samples repository and set up release version to perform smoke tests against just staged artifacts.
spring-github-workflows/samples/verify-staged-artifacts.yml
Lines 1 to 28 in 78b2912
The spring-backport-issue.yml uses Spring 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.
spring-github-workflows/samples/backport-issue.yml
Lines 1 to 16 in 521ac48
If Dependabot is enabled for the repository, its config should set a label compatible with Spring Changelog Generator. Typically, it is type: dependency-upgrade. It is also a good practice to group all the development dependencies into a single pull request from Dependabot. This includes all the Gradle and Maven plugins and those dependencies which are used only for testing in the project. This project provides a spring-merge-dependabot-pr.yml reusable workflow to make modifications to the Dependabot pull requests. However, there are some prerequisites to use this workflow in your project:
The spring-merge-dependabot-pr workflow does these modifications to the Dependabot pull requests:
The mergeArguments input of this workflow is applied to the gh pr merge command.
spring-github-workflows/samples/merge-dependabot-pr.yml
Lines 1 to 13 in 521ac48
The spring-cherry-pick.yml workflow offers a logic to cherry-pick pushed commits to branches suggested by the specific sentence in each commit message. Every commit in the push is considered, not just the last one. For example Auto-cherry-pick to 6.2.x & 6.1.x. The Auto-cherry-pick token is a default value for the autoCherryPickToken input of this workflow. The branches to cherry-pick to are extracted from the matching sentence. The "Auto-cherry-pick" sentence is removed from the target commit message. The -x option of git cherry-pick command adds a link back to the original commit. Force-pushes (e.g. a rebase) are skipped entirely, and any commit whose patch is already present on the target branch is skipped as well, to avoid replaying cherry-picks that were already performed. Re-runs of this workflow are cancelled: a failed cherry-pick needs a manual fix pushed by hand, not a retry of the same automated logic.
The spring-announce-milestone-planning.yml workflow offers an automatic chat message publishing when due_on on the repository milestone is changed. The callers workflow must be configured like this:
name: Announce Milestone Planning in Chat
on:
milestone:
types: [ created, edited ]
jobs:
announce-milestone-planning:
uses: spring-io/spring-github-workflows/.github/workflows/spring-announce-milestone-planning.yml@main
secrets:
SPRING_RELEASE_CHAT_WEBHOOK_URL: ${{ secrets.SPRING_RELEASE_GCHAT_WEBHOOK_URL }}The workflow reacts to non-empty due_on property of the event's milestone payload and check if this property really was changed on milestone edit.
The spring-trigger-dependabot-updates.yml workflow is a convenient alternative to the GitHub UI interface for Dependabot updates ($GH_REPOSITORY/network/updates). The workflow performs toggle executable permission as a superficial change on the dependabot.yml file. That is enough for Dependabot to understand that some changes have happened in the dependency updates config to trigger new versions check.
The spring-dispatch-workflow-and-wait action implements the logic to call gh workflow run for the provided workflow file and wait until it is complete, successful or not. This action is used in the verify-staged job of the release workflow.
The Gradle Build Actionand a script with Maven repository for publishing artifacts into a local directory (/deployment-repository) via respective publishAllPublicationsToDeploymentRepository Gradle task. Then spring-io/artifactory-deploy-action picks up those artifacts for uploading to the Artifactory. The Maven build does that via deploy goal and respective -DaltDeploymentRepository=local::file:deployment-repository CLI option.
See more information in the Reusing Workflows.
| Back | FazBrowse Home | New Git URL |