-
Notifications
You must be signed in to change notification settings - Fork 0
81 lines (77 loc) · 2.67 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
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
name: Deploy
on:
workflow_dispatch:
workflow_run:
workflows: [Release]
types:
- completed
jobs:
notify-start:
runs-on: ubuntu-latest
steps:
- name: Discord Webhook - Notify Start Deploy
uses: tsickert/[email protected]
continue-on-error: true
with:
username: "Mirasaki Development CI/CD"
avatar-url: "https://mirasaki.dev/logo.png"
webhook-url: ${{ secrets.DEPLOYMENT_WEBHOOK_URL }}
embed-author-name: "Continuous Deployment by Mirasaki Development"
embed-author-url: "https://mirasaki.dev"
embed-author-icon-url: "https://mirasaki.dev/logo.png"
embed-color: 14228765
embed-title: "⬇️ cftools.js"
embed-description: "⌛ Deploying **`@${{ github.repository }}`**...\n📤 Service is now temporarily unavailable."
deploy:
permissions:
id-token: write
contents: read
name: deploy
needs: notify-start
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Fetch Teleport binaries
uses: teleport-actions/setup@v1
with:
version: 16.4.0
- name: Fetch credentials using Machine ID
id: auth
uses: teleport-actions/auth@v2
with:
proxy: tp.mirasaki.dev:443
token: deploy-bot
certificate-ttl: 1h
anonymous-telemetry: 1
- name: SSH into Server and Prepare Environment
run: |
tsh ssh [email protected] << 'ENDSSH'
cd /var/www/cftools.js
echo "Stashing any local changes..."
git stash
echo "Pulling latest changes..."
git pull origin main
echo "Installing development dependencies..."
npm install
echo "Building the project's documentation..."
npm run build:docs
exit
ENDSSH
notify-finish:
needs: deploy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Discord Webhook - Notify Finish Deploy
uses: tsickert/[email protected]
with:
username: "Mirasaki Development CI/CD"
avatar-url: "https://mirasaki.dev/logo.png"
webhook-url: ${{ secrets.DEPLOYMENT_WEBHOOK_URL }}
embed-author-name: "Continuous Deployment by Mirasaki Development"
embed-author-url: "https://mirasaki.dev"
embed-author-icon-url: "https://mirasaki.dev/logo.png"
embed-color: 9559538
embed-title: "⬆️ cftools.js"
embed-description: "✅ Finished deploying **`@${{ github.repository }}`**\n📥 [Service](https://cftools.mirasaki.dev) is back online"