You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: .github/workflows/README-deploy.md
+44-1Lines changed: 44 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -54,7 +54,7 @@ Deploy and docs are enabled for one JDK per branch (JDK 8 if the branch has JDK
54
54
55
55
### Basic usage from a Spring Cloud repo
56
56
57
-
In your project’s `.github/workflows/deploy.yml`:
57
+
In your project’s `.github/workflows/ci.yml`:
58
58
59
59
```yaml
60
60
jobs:
@@ -72,6 +72,49 @@ jobs:
72
72
73
73
For commercial projects, also pass `COMMERCIAL_ARTIFACTORY_USERNAME` and `COMMERCIAL_ARTIFACTORY_PASSWORD`.
74
74
75
+
#### Triggering The Workflow
76
+
77
+
You can trigger the workflow from a variety of events. Most repos will want to trigger the workflow on pushes, a schedule, and a manual trigger.
78
+
79
+
```yaml
80
+
on:
81
+
push:
82
+
branches:
83
+
- main
84
+
# other supported branched
85
+
- 4.3.x
86
+
- 4.2.x
87
+
88
+
# Scheduled builds run daily at midnight UTC
89
+
schedule:
90
+
- cron: '0 0 * * *'
91
+
92
+
# Manual trigger with optional branch override
93
+
workflow_dispatch:
94
+
inputs:
95
+
branches:
96
+
description: "Which branch should be built (can be a comma-separated list of branches)"
97
+
required: true
98
+
default: 'main'
99
+
type: string
100
+
```
101
+
102
+
There are a few things to note about how the schedule and push triggers work on GitHub.
103
+
104
+
##### Scheduled Triggers
105
+
106
+
**Scheduled triggers only get triggered from the repo's default branch.**
107
+
This means that if `main` is the default branch in your repo and you have the configuration above setup in your workflow, that there will not be any scheduled execution on the 4.3.x. and 4.2.x branches. The `deploy.yaml` in this repo takes that into account. When your workflow is triggered to run via a schedule event `deploy.yaml` will setup the matrix to build all supported branches configured in the projects.json. When you look at the workflow in the GitHub Actions UI you will see something that looks like this for scheduled executions.
Notice the workflow was triggered via a scheduled event, ran on the `main`
112
+
branch (which is the default branch in this repo) but it checked out and built all supported branches for this repo (determined via `projects.json`).
113
+
114
+
##### Push Triggers
115
+
116
+
Given that scheduled triggers only execute on the default branch and we can build all the other branches from the default branch it might not seem necessary to have a workflow on the other supported branches in the repo. Unfortunately for push events the workflow needs to be present on the branch the push event occurred in order for it to execute. **If you want to build and deploy your snapshots on push events to branches other than the default branch your workflow also needs to be in the `.github/workflows` folder on those branches.**
117
+
75
118
### Example caller workflow
76
119
77
120
A full example with `push`, `schedule`, and `workflow_dispatch` (including optional `branches` and `runs_on`) is in [examples/deploy.yml](../../examples/deploy.yml). Copy and adapt that file into your project’s `.github/workflows/deploy.yml`.
Copy file name to clipboardExpand all lines: README.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -29,6 +29,6 @@ Shared GitHub Actions workflows and composite actions for Spring Cloud projects.
29
29
30
30
1. In your Spring Cloud project, add a workflow that calls the deploy workflow (see [examples/deploy.yml](examples/deploy.yml)).
31
31
2. Configure the required secrets in your repository (`ARTIFACTORY_*`, `DOCKERHUB_*`; add `COMMERCIAL_*` for commercial repos).
32
-
3. Trigger via push, schedule, or `workflow_dispatch`. The deploy workflow will use this repo’s config and actions to decide what to build and deploy.
32
+
3. Trigger via push, schedule, and/or `workflow_dispatch`. The deploy workflow will use this repo’s config and actions to decide what to build and deploy.
33
33
34
34
For full details on inputs, secrets, and behavior, see the [Deploy workflow README](.github/workflows/README-deploy.md) and the [Determine Matrix action README](.github/actions/determine-matrix/README.md).
0 commit comments