Skip to content

Commit 62caba5

Browse files
authored
chore(ci): deploy only on Sunday or on demand (#1541)
It's because whenever a deployment happens, there's a short downtime. The problem is not yet solved, so as a workaround, let's deploy in a controlled manner (and not e.g. at every Renovate update), at a time where little traffic should flow (Sunday, midnight UTC).
1 parent 5b80717 commit 62caba5

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

.github/workflows/bindings-server.main.kts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@ import io.github.typesafegithub.workflows.actions.gradle.ActionsSetupGradle
1111
import io.github.typesafegithub.workflows.annotations.ExperimentalKotlinLogicStep
1212
import io.github.typesafegithub.workflows.domain.Environment
1313
import io.github.typesafegithub.workflows.domain.RunnerType.UbuntuLatest
14-
import io.github.typesafegithub.workflows.domain.triggers.PullRequest
15-
import io.github.typesafegithub.workflows.domain.triggers.Push
14+
import io.github.typesafegithub.workflows.domain.triggers.*
1615
import io.github.typesafegithub.workflows.dsl.expressions.Contexts
1716
import io.github.typesafegithub.workflows.dsl.expressions.expr
1817
import io.github.typesafegithub.workflows.dsl.workflow
@@ -35,6 +34,8 @@ workflow(
3534
on = listOf(
3635
Push(branches = listOf("main")),
3736
PullRequest(),
37+
Schedule(triggers = listOf(Cron(minute = "0", hour = "0", dayWeek = "SUN"))),
38+
WorkflowDispatch(),
3839
),
3940
sourceFile = __FILE__,
4041
) {
@@ -128,7 +129,7 @@ workflow(
128129
id = "deploy",
129130
name = "Deploy to DockerHub",
130131
runsOn = UbuntuLatest,
131-
`if` = expr { "${github.event_name} == 'push'" },
132+
`if` = expr { "${github.event_name} == 'workflow_dispatch' || ${github.event_name} == 'schedule'" },
132133
needs = listOf(endToEndTest),
133134
env = mapOf(
134135
"DOCKERHUB_USERNAME" to expr { DOCKERHUB_USERNAME },

.github/workflows/bindings-server.yaml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ on:
88
branches:
99
- 'main'
1010
pull_request: {}
11+
schedule:
12+
- cron: '0 0 * * SUN'
13+
workflow_dispatch: {}
1114
jobs:
1215
check_yaml_consistency:
1316
name: 'Check YAML consistency'
@@ -81,7 +84,7 @@ jobs:
8184
env:
8285
DOCKERHUB_USERNAME: '${{ secrets.DOCKERHUB_USERNAME }}'
8386
DOCKERHUB_PASSWORD: '${{ secrets.DOCKERHUB_PASSWORD }}'
84-
if: '${{ github.event_name == ''push'' }}'
87+
if: '${{ github.event_name == ''workflow_dispatch'' || github.event_name == ''schedule'' }}'
8588
environment:
8689
name: 'DockerHub'
8790
steps:

0 commit comments

Comments
 (0)