-
Notifications
You must be signed in to change notification settings - Fork 2
171 lines (161 loc) · 5.58 KB
/
ci.yaml
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
name: ci
on:
push:
branches:
- "**"
pull_request:
branches:
- "**"
jobs:
build:
runs-on: ubuntu-latest
if: github.event.head_commit.author.name != 'github-actions[bot]'
environment: demo
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: "16"
- run: yarn
- name: Copy .env file for drama queen
env:
VITE_QUEEN_URL: ${{ vars.VITE_QUEEN_URL }}
VITE_QUEEN_V2_URL: ${{ vars.VITE_QUEEN_V2_URL }}
run: |
cp drama-queen/.env drama-queen/.env.build
sed -i "s#VITE_QUEEN_URL=#VITE_QUEEN_URL=${VITE_QUEEN_URL}#" drama-queen/.env.build
sed -i "s#VITE_QUEEN_V2_URL=#VITE_QUEEN_V2_URL=${VITE_QUEEN_V2_URL}#" drama-queen/.env.build
- run: yarn build
- uses: actions/upload-artifact@v3
with:
name: drama
path: drama-queen/dist
- uses: actions/upload-artifact@v3
with:
name: queen
path: queen/build
- uses: actions/upload-artifact@v3
with:
name: queen-v2
path: queen-v2/build
check_if_version_upgraded:
needs: build
runs-on: ubuntu-latest
if: |
github.event_name == 'push' &&
github.ref_name == 'main'
outputs:
is_upgraded_version: ${{ steps.check.outputs.changed }}
version: ${{ steps.check.outputs.version }}
is_drama_upgraded_version: ${{ steps.check-drama.outputs.changed }}
drama_version: ${{ steps.check-drama.outputs.version }}
is_queen_upgraded_version: ${{ steps.check-queen.outputs.changed }}
queen_version: ${{ steps.check-queen.outputs.version }}
is_queen_v2_upgraded_version: ${{ steps.check-queen-v2.outputs.changed }}
queen_v2_version: ${{ steps.check-queen-v2.outputs.version }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
- name: Check if container version has been updated
id: check
uses: EndBug/version-check@v2
- name: Check if drama queen version has been updated
id: check-drama
uses: EndBug/version-check@v2
with:
file-name: drama-queen/package.json
- name: Check if queen version has been updated
id: check-queen
uses: EndBug/version-check@v2
with:
file-name: queen/package.json
- name: Check if queen-v2 version has been updated
id: check-queen-v2
uses: EndBug/version-check@v2
with:
file-name: queen-v2/package.json
docker_drama:
needs: check_if_version_upgraded
if: needs.check_if_version_upgraded.outputs.is_drama_upgraded_version == 'true'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: docker/setup-qemu-action@v2
- uses: docker/setup-buildx-action@v2
- uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- uses: actions/download-artifact@v3
with:
name: drama
path: drama-queen/dist
- uses: docker/build-push-action@v4
with:
platforms: linux/amd64,linux/arm64
context: drama-queen
push: true
tags: |
inseefr/drama-queen:latest,
inseefr/drama-queen:${{ needs.check_if_version_upgraded.outputs.drama_version }}
docker_queen:
needs: check_if_version_upgraded
if: needs.check_if_version_upgraded.outputs.is_queen_upgraded_version == 'true'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: docker/setup-qemu-action@v2
- uses: docker/setup-buildx-action@v2
- uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- uses: actions/download-artifact@v3
with:
name: queen
path: queen/build
- uses: docker/build-push-action@v4
with:
platforms: linux/amd64,linux/arm64
context: ./queen
push: true
tags: inseefr/queen:${{ needs.check_if_version_upgraded.outputs.queen_version }}
docker_queen_v2:
needs: check_if_version_upgraded
if: needs.check_if_version_upgraded.outputs.is_queen_v2_upgraded_version == 'true'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: docker/setup-qemu-action@v2
- uses: docker/setup-buildx-action@v2
- uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- uses: actions/download-artifact@v3
with:
name: queen-v2
path: queen-v2/build
- uses: docker/build-push-action@v4
with:
platforms: linux/amd64,linux/arm64
context: ./queen-v2
push: true
tags: inseefr/queen:${{ needs.check_if_version_upgraded.outputs.queen_v2_version }}
release:
runs-on: ubuntu-latest
needs: check_if_version_upgraded
if: needs.check_if_version_upgraded.outputs.is_upgraded_version == 'true'
steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.ref }}
- uses: softprops/action-gh-release@v1
with:
name: Release v${{ needs.check_if_version_upgraded.outputs.version }}
tag_name: v${{ needs.check_if_version_upgraded.outputs.version }}
target_commitish: ${{ github.head_ref || github.ref }}
generate_release_notes: true
draft: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}