-
Notifications
You must be signed in to change notification settings - Fork 0
108 lines (96 loc) · 4.42 KB
/
deploy-admin-dev.yml
File metadata and controls
108 lines (96 loc) · 4.42 KB
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
name: Deploy Yogieat Admin (develop)
on:
push:
branches:
- develop
jobs:
build_and_deploy_dev:
runs-on: ubuntu-latest
environment: DEV
concurrency:
group: yogieat-admin-deploy
cancel-in-progress: false
permissions:
contents: read
steps:
- name: Checkout source
uses: actions/checkout@v4
- name: Resolve image tags
id: meta
run: |
echo "short_sha=${GITHUB_SHA::7}" >> "$GITHUB_OUTPUT"
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Setup Buildx
uses: docker/setup-buildx-action@v3
- name: Build and push develop image
uses: docker/build-push-action@v6
with:
context: .
file: docker/Dockerfile
push: true
tags: |
docker.io/${{ secrets.DOCKERHUB_USERNAME }}/yogieat-admin:develop-${{ steps.meta.outputs.short_sha }}
docker.io/${{ secrets.DOCKERHUB_USERNAME }}/yogieat-admin:develop-latest
build-args: |
BUILD_PATH=dist/dev-admin
REACT_APP_API_URL=https://dev-api.yogieat.com
REACT_APP_ADMIN_API_PREFIX=/api/v1/admin
REACT_APP_USE_MOCK_API=false
- name: Create deployment source archive
run: |
tar -czf /tmp/deploy-source.tgz \
--exclude=.git \
--exclude=.github \
--exclude=node_modules \
--exclude=.pnpm-store \
--exclude=dist \
--exclude=build \
--exclude=deploy-source.tgz \
.
- name: Prepare deploy artifacts
run: mv /tmp/deploy-source.tgz scripts/deploy/deploy-source.tgz
- name: Prepare remote deploy directory
uses: appleboy/ssh-action@v1.0.0
with:
host: ${{ secrets.SERVER_HOST }}
username: ${{ secrets.SERVER_USERNAME }}
key: ${{ secrets.SERVER_PRIVATE_KEY }}
script: mkdir -p /tmp/yogieat-admin/deploy
- name: Copy deploy script to Server
uses: burnett01/rsync-deployments@7.0.1
with:
switches: -rlvz --delete --omit-dir-times --no-owner --no-group
remote_host: ${{ secrets.SERVER_HOST }}
remote_user: ${{ secrets.SERVER_USERNAME }}
remote_key: ${{ secrets.SERVER_PRIVATE_KEY }}
path: ./scripts/deploy/
remote_path: /tmp/yogieat-admin/deploy/
- name: Deploy atomically
uses: appleboy/ssh-action@v1.0.0
with:
host: ${{ secrets.SERVER_HOST }}
username: ${{ secrets.SERVER_USERNAME }}
key: ${{ secrets.SERVER_PRIVATE_KEY }}
script: |
mv /tmp/yogieat-admin/deploy/deploy-source.tgz /tmp/yogieat-admin-source.tgz
DOCKERHUB_NAMESPACE="${{ secrets.DOCKERHUB_USERNAME }}" bash /tmp/yogieat-admin/deploy/deploy-yogieat-admin.sh dev ${{ steps.meta.outputs.short_sha }} develop
- name: Discord notification
if: always()
uses: sarisia/actions-status-discord@v1
with:
webhook: ${{ secrets.DISCORD_WEBHOOK }}
title: "🚀 ADMIN DEV CLIENT 빌드 및 배포"
description: |
**상태**: ${{ job.status }}
**브랜치**: ${{ github.ref_name }}
**커밋**: ${{ github.sha }}
**커밋 메시지**: ${{ github.event.head_commit.message }}
**API 이미지**: ${{ steps.image-tags.outputs.api_image }}
**ADMIN 이미지**: ${{ steps.image-tags.outputs.admin_image }}
**BATCH 이미지**: ${{ steps.image-tags.outputs.batch_image }}
color: ${{ job.status == 'success' && '0x57F287' || '0xED4245' }}
username: GitHub Actions