-
Notifications
You must be signed in to change notification settings - Fork 2
45 lines (41 loc) · 1.39 KB
/
develop-deploy.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
name: Develop Deploy
on:
workflow_dispatch:
inputs:
commit_hash:
description: 'commit_hash'
required: true
env:
DOCKERHUB_IMAGE_NAME: walwal-server
jobs:
build-deploy:
runs-on: ubuntu-latest
environment: DEV
steps:
# EC2로 배포
- name: Deploy to EC2 Server
uses: appleboy/[email protected]
env:
IMAGE_FULL_URL: ${{ steps.metadata.outputs.tags }}
DOCKERHUB_IMAGE_NAME: ${{ env.DOCKERHUB_IMAGE_NAME }}
with:
host: ${{ secrets.EC2_HOST }}
username: ${{ secrets.EC2_USERNAME }}
key: ${{ secrets.EC2_PRIVATE_KEY }}
envs: IMAGE_FULL_URL, DOCKERHUB_IMAGE_NAME # docker-compose.yml 에서 사용할 환경 변수
debug: true
script: |
echo "${{ secrets.DOCKERHUB_TOKEN }}" | docker login -u "${{ secrets.DOCKERHUB_USERNAME }}" --password-stdin
docker compose up -d
docker exec -d nginx nginx -s reload
docker image prune -a -f
## Slack
- name: Slack Alarm
uses: 8398a7/action-slack@v3
with:
status: ${{ job.status }}
author_name: GitHub-Actions CI/CD
fields: repo,message,commit,author,ref,job,took
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} # required
if: always() # Pick up events even if the job fails or is canceled.