This repository has been archived by the owner on Oct 8, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 1
246 lines (201 loc) Β· 9.45 KB
/
notice.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
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
name: notice
on:
push:
branches: [main]
paths:
- '.github/workflows/notice.yml'
- 'api/**'
- 'lib/**'
- 'index.js'
# pull_request:
# branches: [main]
jobs:
# notice-ui:
# runs-on: ${{ matrix.os }}
# env:
# # IMAGE_OWNER: dvgamerr
# # IMAGE_NAME: line-liff
# # PLATFORMS: linux/amd64,linux/arm64/v8
# # IMAGE_FILE: notice-ui.Dockerfile
# # KUBE_DEPLOY: deploy/line-liff
# # KUBE_CONTAINER: line-liff
# # KUBE_NAMESPACE: notice-line
# # BASE_URL: https://notice.touno.io
# steps:
# - name: Checkout π
# uses: actions/checkout@master
# - name: Install Node.js
# uses: actions/setup-node@v4
# with:
# node-version: 16
# - name: Get yarn cache directory path π
# id: yarn-cache-dir-path
# run: echo "::set-output name=dir::$(yarn cache dir)"
# - name: Cache node_modules π¦
# uses: actions/[email protected]
# id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
# with:
# path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
# key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
# restore-keys: |
# ${{ runner.os }}-yarn-
# - name: Install dependencies π¨π»βπ»
# run: pnpm i --prod
# # - name: Run linter π
# # run: yarn lint
# - name: Run Build βοΈ
# run: yarn build
# - name: Prepare π°
# id: prepare
# run: |
# echo ::set-output name=kube_deploy::${KUBE_DEPLOY}
# echo ::set-output name=kube_container::${KUBE_CONTAINER}
# echo ::set-output name=kube_namespace::${KUBE_NAMESPACE}
# VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')
# # Strip "v" prefix from tag name
# [[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=v$(echo $VERSION | sed -e 's/^v//')
# # Use Docker `latest` tag convention
# [ "$VERSION" == "main" ] && VERSION=latest
# # Use Docker `test` tag convention
# [ "${{github.event_name}}" == "pull_request" ] && VERSION=test
# echo ::set-output name=docker_image::$IMAGE_OWNER/$IMAGE_NAME
# echo ::set-output name=version::${VERSION}
# echo ::set-output name=buildx_args::--platform $PLATFORMS \
# --build-arg VERSION=${VERSION} \
# --build-arg BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ') \
# --build-arg VERSION=$VERSION \
# --tag $IMAGE_OWNER/$IMAGE_NAME:$VERSION --file $IMAGE_FILE .
# - name: Set up Docker Buildx π
# uses: docker/setup-buildx-action@v2
# - name: Docker Buildx βοΈ
# run: docker buildx build --output "type=image,push=false" ${{ steps.prepare.outputs.buildx_args }}
# - name: Notify After Build Fail π
# if: failure() && github.event_name != 'pull_request'
# run: curl -X PUT https://notice.touno.io/system/notice/%E2%9D%8C%20*%5BFailure%5D*%20Steps:%20Docker%20Buildx%20%E2%9A%99%EF%B8%8F
# - name: Login to DockerHub
# if: success() && github.event_name != 'pull_request'
# uses: docker/login-action@v3
# with:
# username: ${{ github.actor }}
# password: ${{ secrets.DOCKER_TOKEN }}
# - name: Docker Push π
# if: success() && github.event_name != 'pull_request'
# run: docker buildx build --output "type=image,push=true" ${{ steps.prepare.outputs.buildx_args }}
# - name: Inspect π
# if: success() && github.event_name != 'pull_request'
# run: docker buildx imagetools inspect ${{ steps.prepare.outputs.docker_image }}:${{ steps.prepare.outputs.version }}
# # - name: Trigger deploy π
# # if: success() && github.event_name != 'pull_request'
# # uses: Consensys/[email protected]
# # env:
# # KUBE_CONFIG_DATA: ${{ secrets.KUBE_CONFIG_DATA }}
# # with:
# # args: set image ${{ steps.prepare.outputs.kube_deploy }} ${{ steps.prepare.outputs.kube_container }}=${{ steps.prepare.outputs.docker_image }}:${{ steps.prepare.outputs.version }} -n ${{ steps.prepare.outputs.kube_namespace }}
# - name: Restart deployment π
# if: success() && github.event_name != 'pull_request'
# uses: Consensys/[email protected]
# env:
# KUBE_CONFIG_DATA: ${{ secrets.KUBE_CONFIG_DATA }}
# with:
# args: rollout restart ${{ steps.prepare.outputs.kube_deploy }} -n ${{ steps.prepare.outputs.kube_namespace }}
# - name: Status deployment π
# if: success() && github.event_name != 'pull_request'
# uses: Consensys/[email protected]
# env:
# KUBE_CONFIG_DATA: ${{ secrets.KUBE_CONFIG_DATA }}
# with:
# args: rollout status ${{ steps.prepare.outputs.kube_deploy }} -n ${{ steps.prepare.outputs.kube_namespace }}
notice:
runs-on: ubuntu-20.04
env:
IMAGE_OWNER: dvgamerr
IMAGE_FILE: Dockerfile
IMAGE_NAME: notice
PLATFORMS: linux/amd64,linux/arm64
outputs:
container_name: ${{ steps.prepare.outputs.docker_image }}:${{ steps.prepare.outputs.version }}
version: ${{ steps.prepare.outputs.version }}
steps:
- name: Checkout π
uses: actions/checkout@v4
# - name: Get yarn cache directory path π
# uses: pnpm/action-setup@v2
# with:
# version: 8
# run_install: true
# - name: Cache node_modules π¦
# uses: actions/cache@v3
# with:
# path: node_modules
# key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
# restore-keys: |
# ${{ runner.os }}-pnpm-store-
# - name: Install dependencies
# run: pnpm i --prod
- name: Prepare π°
id: prepare
run: |
echo "kube_container=${KUBE_CONTAINER}" >> $GITHUB_OUTPUT
echo "kube_namespace=${KUBE_NAMESPACE}" >> $GITHUB_OUTPUT
echo "docker_image=${{github.actor}}/$IMAGE_NAME" >> $GITHUB_OUTPUT
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')
# # Strip "v" prefix from tag name
# [[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=v$(echo $VERSION | sed -e 's/^v//')
# # Use Docker `latest` tag convention
[ "$VERSION" == "main" ] && VERSION=latest
echo "version=${VERSION}" >> $GITHUB_OUTPUT
echo "buildx_args=--platform $PLATFORMS \
--build-arg VERSION=${VERSION} \
--build-arg BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ') \
--build-arg VERSION=$VERSION \
--tag ${{github.actor}}/$IMAGE_NAME:$VERSION --file $IMAGE_FILE ." >> $GITHUB_OUTPUT
- name: Set up Docker Buildx π
uses: docker/setup-buildx-action@v3
- name: Docker Buildx βοΈ
run: docker buildx build --output "type=image,push=false" ${{ steps.prepare.outputs.buildx_args }}
# - name: Notify After Build Fail π
# if: failure() && github.event_name != 'pull_request'
# run: curl -X PUT https://notice.touno.io/system/notice/%E2%9D%8C%20*%5BFailure%5D*%20Steps:%20Docker%20Buildx%20%E2%9A%99%EF%B8%8F
- name: Login to DockerHub
if: success() && github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
username: ${{ github.actor }}
password: ${{ secrets.DOCKER_TOKEN }}
- name: Docker Push π
run: docker buildx build --output "type=image,push=${{ github.event_name != 'pull_request' }}" ${{ steps.prepare.outputs.buildx_args }}
# - name: Trigger deploy π
# if: success() && github.event_name != 'pull_request'
# uses: Consensys/[email protected]
# env:
# KUBE_CONFIG_DATA: ${{ secrets.KUBE_CONFIG_DATA }}
# with:
# args: set image ${{ steps.prepare.outputs.kube_deploy }} ${{ steps.prepare.outputs.kube_container }}=${{ steps.prepare.outputs.docker_image }}:${{ steps.prepare.outputs.version }} -n ${{ steps.prepare.outputs.kube_namespace }}
# - name: Restart deployment π
# if: success() && github.event_name != 'pull_request'
# uses: Consensys/[email protected]
# env:
# KUBE_CONFIG_DATA: ${{ secrets.KUBE_CONFIG_DATA }}
# with:
# args: rollout restart ${{ steps.prepare.outputs.kube_deploy }} -n ${{ steps.prepare.outputs.kube_namespace }}
# - name: Status deployment π
# if: success() && github.event_name != 'pull_request'
# uses: Consensys/[email protected]
# env:
# KUBE_CONFIG_DATA: ${{ secrets.KUBE_CONFIG_DATA }}
# with:
# args: rollout status ${{ steps.prepare.outputs.kube_deploy }} -n ${{ steps.prepare.outputs.kube_namespace }}
# notify-api:
# runs-on: ubuntu-20.04
# needs: notice
# if: failure() && github.event_name != 'pull_request'
# steps:
# - name: Notify π
# run: curl -X PUT https://notice.touno.io/system/notice/%E2%9D%8C%20*%5BFailure%5D*%20Job:%20${{ github.job }}%20%E2%9A%99%EF%B8%8F
# notify-ui:
# runs-on: ubuntu-20.04
# needs: notice-ui
# if: failure() && github.event_name != 'pull_request'
# steps:
# - name: Notify π
# run: curl -X PUT https://notice.touno.io/system/notice/%E2%9D%8C%20*%5BFailure%5D*%20Job:%20${{ github.job }}%20%E2%9A%99%EF%B8%8F