-
Notifications
You must be signed in to change notification settings - Fork 0
39 lines (33 loc) Β· 1.48 KB
/
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
name: Deploy
on:
push:
branches:
- Weekly
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: π₯ Checkout Repository
uses: actions/checkout@v4
- name: π Set Up SSH Authentication
uses: webfactory/[email protected]
with:
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
- name: π Run Deployment Script on Server
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
run: |
ssh -o StrictHostKeyChecking=no ubuntu@${{ secrets.SERVER_IP }} "SLACK_WEBHOOK_URL=${{ secrets.SLACK_WEBHOOK_URL }} bash /home/ubuntu/deploy.sh"
# μλ²μ deploy.sh μ€ν¬λ¦½νΈλ₯Ό ν΅ν΄ 무μ€λ¨ λ°°ν¬λ₯Ό μ§νν©λλ€.
# 무μ€λ¨ λ°°ν¬ μ±κ³΅ μ Slack μλ¦Όμ μ μ‘νλλ‘ μ€μ λμ΄ μμ΅λλ€.
- name: π’ Notify Deployment Status on Slack
if: always()
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
run: |
if [ $? -eq 0 ]; then
curl -X POST -H 'Content-type: application/json' --data '{"text": "π *μ΅μ’
λ°°ν¬ μ±κ³΅* - λ°°ν¬κ° μ±κ³΅μ μΌλ‘ μλ£λμμ΅λλ€!"}' $SLACK_WEBHOOK_URL
else
curl -X POST -H 'Content-type: application/json' --data '{"text": "β οΈ *λ°°ν¬ μ€ν¨* - λ°°ν¬ κ³Όμ μμ λ¬Έμ κ° λ°μνμ΅λλ€."}' $SLACK_WEBHOOK_URL
fi
# λ°°ν¬ μ€ν¬λ¦½νΈκ° μ±κ³΅μ μΌλ‘ μ€νλμλμ§ μ¬λΆλ₯Ό SlackμΌλ‘ μ립λλ€.