-
Notifications
You must be signed in to change notification settings - Fork 5
135 lines (133 loc) · 5.04 KB
/
build-and-deployment-workflow.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
name: Setops Deployment
on:
workflow_call:
inputs:
setops-api-domain:
description: The SetOps API URL to connect to
required: false
default: "api.setops.co"
type: string
setops-organization:
description: The SetOps organization
required: true
type: string
setops-project:
required: true
type: string
setops-stages:
description: The SetOps stages to deploy to, space separated, e.g. "stage1 stage2 stage3"
required: true
type: string
setops-apps:
description: The SetOps apps to deploy, space separated, e.g. "app1 app2 app3"
required: true
type: string
predeploy-command:
required: false
type: string
predeploy-command-detach-timeout:
required: false
type: string
predeploy-command-cpu:
required: false
type: string
predeploy-command-memory:
type: string
required: false
build-context:
description: The build context / directory where the Dockerfile is located, defaults to '.'
required: false
default: .
type: string
build-cache-key-prefix:
description: The cache key used by docker buildx. The complete cache key is concatenated
required: false
default: app
type: string
build-args:
description: Docker build args
required: false
type: string
setops-definition:
description: Path to the SetOps definition that should be applied in the deployment
required: false
type: string
image-tag:
description: The tag with which the image(s) should be tagged e.g. v1.1.0, defaults to commit hash
default: ${{ github.sha }}
required: false
type: string
setops-version:
description: "The version of SetOps CLI to install. Instead of a full version string you can also specify a constraint string. Examples are: `<0.1.5`, `~0.1.4`, `0.1.x` (all three installing the latest available 0.1.4 version). Defaults to `latest`."
required: false
type: string
secrets:
setops-username:
required: true
setops-password:
required: true
build-secrets:
description: Docker build secrets
required: false
github-token:
description: GitHub token to reduce the risk of rate limits when downloading the requested SetOps CLI
required: false
jobs:
build:
name: Build and push image
runs-on: ubuntu-latest
outputs:
image-tag: ${{ steps.build-and-push-image.outputs.image-tag }}
stages-json: ${{ steps.build-and-push-image.outputs.stages-json }}
steps:
- name: "Checkout repository"
uses: actions/checkout@v4
- name: "Build image and push it to SetOps image registry"
id: build-and-push-image
uses: setopsco/github-actions/build-and-push-image@v4
with:
setops-api-domain: ${{ inputs.setops-api-domain }}
setops-organization: ${{ inputs.setops-organization }}
setops-project: ${{ inputs.setops-project }}
setops-stages: ${{ inputs.setops-stages }}
setops-apps: ${{ inputs.setops-apps }}
setops-username: ${{ secrets.setops-username }}
setops-password: ${{ secrets.setops-password }}
setops-version: ${{ inputs.setops-version }}
image-tag: ${{ inputs.image-tag }}
build-context: ${{ inputs.build-context }}
build-cache-key-prefix: ${{ inputs.build-cache-key-prefix }}
build-args: ${{ inputs.build-args }}
build-secrets: ${{ secrets.build-secrets }}
github-token: ${{ secrets.github-token }}
deploy:
name: Setops Deployment
strategy:
fail-fast: false
matrix:
setops-stage: ${{ fromJson(needs.build.outputs.stages-json) }}
concurrency: setops-deployment-${{ github.ref }}
runs-on: ubuntu-latest
needs: build
steps:
- name: "Checkout repository"
uses: actions/checkout@v4
- name: "Deploy apps on SetOps"
id: deploy
uses: setopsco/github-actions/deployment@v4
with:
setops-api-domain: ${{ inputs.setops-api-domain }}
setops-organization: ${{ inputs.setops-organization }}
setops-project: ${{ inputs.setops-project }}
setops-stage: ${{ matrix.setops-stage }}
setops-apps: ${{ inputs.setops-apps }}
setops-username: ${{ secrets.setops-username }}
setops-password: ${{ secrets.setops-password }}
setops-definition: ${{ inputs.setops-definition }}
setops-version: ${{ inputs.setops-version }}
image-tag: ${{ inputs.image-tag }}
predeploy-command: ${{ inputs.predeploy-command }}
predeploy-command-detach-timeout: ${{ inputs.predeploy-command-detach-timeout }}
predeploy-command-cpu: ${{ inputs.predeploy-command-cpu }}
predeploy-command-memory: ${{ inputs.predeploy-command-memory }}
github-token: ${{ secrets.github-token }}