-
Notifications
You must be signed in to change notification settings - Fork 16
155 lines (151 loc) · 5.07 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
name: Build and Publish Release
on:
push:
branches:
- dev
release:
types: [published]
jobs:
build-and-push-frontend:
runs-on: ubuntu-latest
steps:
-
name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
-
name: Set up QEMU
uses: docker/setup-qemu-action@v1
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- uses: actions/checkout@v2
with:
submodules: true
-
name: Get Tag Name
id: vars
shell: bash
run: |
echo "##[set-output name=tag_name;]$(echo ${GITHUB_REF#refs/heads/}-$(date +'%Y%m%d')$(git rev-parse --short HEAD))"
echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})"
- name: Use Node.js 15
uses: actions/setup-node@v2-beta
with:
node-version: '15'
check-latest: true
- run: yarn
working-directory: frontend
- run: yarn run build
working-directory: frontend
env:
REACT_APP_VERSION: ${{ github.event.release.tag_name || steps.vars.outputs.tag_name }}
NODE_ENV: production
-
name: Build and Publish Frontend ${{ github.event.release.tag_name || steps.vars.outputs.tag_name }}
id: docker_build_frontend_tagged_version
uses: docker/build-push-action@v2
with:
context: ./frontend
file: ./frontend/Dockerfile
platforms: linux/amd64,linux/arm64
push: true
tags: leishi1313/aurora-admin-frontend:${{ github.event.release.tag_name || steps.vars.outputs.tag_name }}
-
if: github.event_name == 'release'
name: Build and Publish Frontend Latest
id: docker_build_frontend_latest
uses: docker/build-push-action@v2
with:
context: ./frontend
file: ./frontend/Dockerfile
platforms: linux/amd64,linux/arm64
push: true
tags: leishi1313/aurora-admin-frontend:latest
-
if: github.event_name != 'release'
name: Build and Publish Frontend Dev Latest
id: docker_build_frontend_test_latest
uses: docker/build-push-action@v2
with:
context: ./frontend
file: ./frontend/Dockerfile
platforms: linux/amd64,linux/arm64
push: true
tags: leishi1313/aurora-admin-frontend:${{ steps.vars.outputs.branch }}-latest
-
name: Frontend digest
run: echo ${{ steps.docker_build_frontend_tagged_version.outputs.digest }}
build-and-push-backend:
runs-on: ubuntu-latest
steps:
-
name: Set up QEMU
uses: docker/setup-qemu-action@v1
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
-
name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- uses: actions/checkout@v2
with:
submodules: true
-
name: Get Tag Name
id: vars
shell: bash
run: |
echo "##[set-output name=tag_name;]$(echo ${GITHUB_REF#refs/heads/}-$(git rev-parse --short HEAD))"
echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})"
-
name: Build and Publish Backend ${{ github.event.release.tag_name || steps.vars.outputs.tag_name }}
id: docker_build_backend_tagged_version
uses: docker/build-push-action@v2
with:
context: ./backend
file: ./backend/Dockerfile
platforms: linux/amd64,linux/arm64
push: true
tags: leishi1313/aurora-admin-backend:${{ github.event.release.tag_name || steps.vars.outputs.tag_name }}
build-args: |
BACKEND_APP_VERSION=${{ github.event.release.tag_name || steps.vars.outputs.tag_name }}
-
if: github.event_name == 'release'
name: Build and Publish Backend Latest
id: docker_build_backend_latest
uses: docker/build-push-action@v2
with:
context: ./backend
file: ./backend/Dockerfile
platforms: linux/amd64,linux/arm64
push: true
tags: leishi1313/aurora-admin-backend:latest
build-args: |
BACKEND_APP_VERSION=${{ github.event.release.tag_name || steps.vars.outputs.tag_name }}
-
if: github.event_name != 'release'
name: Build and Publish Backend Dev Latest
id: docker_build_backend_test_latest
uses: docker/build-push-action@v2
with:
context: ./backend
file: ./backend/Dockerfile
platforms: linux/amd64,linux/arm64
push: true
tags: leishi1313/aurora-admin-backend:${{ steps.vars.outputs.branch }}-latest
build-args: |
BACKEND_APP_VERSION=${{ github.event.release.tag_name || steps.vars.outputs.tag_name }}
-
name: Backend digest
run: echo ${{ steps.docker_build_backend_tagged_version.outputs.digest }}
- name: Send message to Telegram
uses: Lukasss93/telegram-action@v2
env:
TELEGRAM_TOKEN: ${{ secrets.TELEGRAM_TOKEN }}
TELEGRAM_CHAT: ${{ secrets.TELEGRAM_CHAT }}