-
Notifications
You must be signed in to change notification settings - Fork 34
178 lines (164 loc) · 5.86 KB
/
release.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
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
name: Release
on:
push:
branches:
- main
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
permissions:
id-token: write
contents: write
jobs:
changes:
name: Repository changes
runs-on: ubuntu-22.04
outputs:
get-version: ${{ steps.getversion.outputs.version }}
cluster-disk-image: ${{ steps.filter.outputs.cluster-disk-image }}
api: ${{ steps.filter.outputs.api }}
envd: ${{ steps.filter.outputs.envd }}
env-instance-task-driver: ${{ steps.filter.outputs.env-instance-task-driver }}
env-build-task-driver: ${{ steps.filter.outputs.env-build-task-driver }}
version: ${{ steps.filter.outputs.version }}
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Get the last release
id: last_release
uses: cardinalby/git-get-release-action@v1
env:
GITHUB_TOKEN: ${{ github.token }}
with:
latest: true
prerelease: false
draft: false
- name: Find changes since the last release
uses: dorny/paths-filter@v2
id: filter
with:
base: ${{ steps.last_release.outputs.tag_name }}
filters: |
cluster-disk-image:
- 'packages/cluster-disk-image/**'
- '.github/workflows/cluster-disk-image.yml'
api:
- 'packages/api/**'
- '.github/workflows/api.yml'
envd:
- 'packages/envd/**'
- '.github/workflows/envd.yml'
env-instance-task-driver:
- 'packages/env-instance-task-driver/**'
- '.github/workflows/env-instance-task-driver.yml'
env-build-task-driver:
- 'packages/env-build-task-driver/**'
- '.github/workflows/env-build-task-driver.yml'
version:
- 'VERSION'
- name: Read Version file
id: getversion
run: echo "::set-output name=version::$(cat VERSION)"
env-instance-task-driver:
name: Env instance task driver
needs: changes
if: |
always() &&
needs.changes.outputs.version == 'true' &&
needs.changes.outputs.env-instance-task-driver == 'true'
uses: ./.github/workflows/env-instance-task-driver.yml
secrets:
workload_identity_provider: ${{ secrets.WORKLOAD_IDENTITY_PROVIDER }}
service_account_email: ${{ secrets.SERVICE_ACCOUNT_EMAIL }}
env-build-task-driver:
name: Env build task driver
needs: changes
if: |
always() &&
needs.changes.outputs.version == 'true' &&
needs.changes.outputs.env-build-task-driver == 'true'
uses: ./.github/workflows/env-build-task-driver.yml
secrets:
workload_identity_provider: ${{ secrets.WORKLOAD_IDENTITY_PROVIDER }}
service_account_email: ${{ secrets.SERVICE_ACCOUNT_EMAIL }}
cluster-disk-image:
name: Cluster disk image
needs: changes
if: |
always() &&
needs.changes.outputs.version == 'true' &&
needs.changes.outputs.cluster-disk-image == 'true'
uses: ./.github/workflows/cluster-disk-image.yml
secrets:
workload_identity_provider: ${{ secrets.WORKLOAD_IDENTITY_PROVIDER }}
service_account_email: ${{ secrets.SERVICE_ACCOUNT_EMAIL }}
envd:
name: Env Daemon
needs: changes
if: |
always() &&
needs.changes.outputs.version == 'true' &&
needs.changes.outputs.envd == 'true'
uses: ./.github/workflows/envd.yml
secrets:
workload_identity_provider: ${{ secrets.WORKLOAD_IDENTITY_PROVIDER }}
service_account_email: ${{ secrets.SERVICE_ACCOUNT_EMAIL }}
version: ${{ needs.changes.outputs.get-version }}
api:
name: API image
needs: changes
if: |
always() &&
needs.changes.outputs.version == 'true' &&
needs.changes.outputs.api == 'true'
uses: ./.github/workflows/api.yml
secrets:
workload_identity_provider: ${{ secrets.WORKLOAD_IDENTITY_PROVIDER }}
service_account_email: ${{ secrets.SERVICE_ACCOUNT_EMAIL }}
gce_project: ${{ secrets.GCE_PROJECT }}
terraform:
name: Terraform
needs:
[
changes,
cluster-disk-image,
api,
envd,
env-instance-task-driver,
env-build-task-driver,
]
if: |
always() &&
needs.changes.outputs.version == 'true' &&
needs.changes.result == 'success' &&
(needs.cluster-disk-image.result == 'success' || needs.cluster-disk-image.result == 'skipped') &&
(needs.envd.result == 'success' || needs.envd.result == 'skipped') &&
(needs.env-instance-task-driver.result == 'success' || needs.env-instance-task-driver.result == 'skipped') &&
(needs.env-build-task-driver.result == 'success' || needs.env-build-task-driver.result == 'skipped') &&
(needs.api.result == 'success' || needs.api.result == 'skipped')
uses: ./.github/workflows/terraform.yml
secrets:
workload_identity_provider: ${{ secrets.WORKLOAD_IDENTITY_PROVIDER }}
service_account_email: ${{ secrets.SERVICE_ACCOUNT_EMAIL }}
client_machine_type: ${{ secrets.CLIENT_MACHINE_TYPE }}
client_cluster_size: ${{ secrets.CLIENT_CLUSTER_SIZE }}
server_machine_type: ${{ secrets.SERVER_MACHINE_TYPE }}
server_cluster_size: ${{ secrets.SERVER_CLUSTER_SIZE }}
# The last successful release is used for determining which changed and what should be deployed in this release.
release:
name: Release
needs: [changes, terraform]
if: |
always() &&
needs.terraform.result == 'success' &&
needs.changes.outputs.version == 'true'
runs-on: ubuntu-22.04
steps:
- name: Create release
uses: ncipollo/release-action@v1
with:
name: API v${{ needs.changes.outputs.get-version }}
tag: v${{ needs.changes.outputs.get-version }}
commit: main
generateReleaseNotes: true