forked from hngprojects/hng_boilerplate_nextjs
-
Notifications
You must be signed in to change notification settings - Fork 0
50 lines (43 loc) · 1.53 KB
/
starlight-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
name: Starlight Deployment
on:
workflow_run:
workflows: ["Build and Upload"]
types:
- completed
jobs:
deploy_to_nestsjs:
if: ${{ github.event.workflow_run.conclusion == 'success' }}
runs-on: ubuntu-latest
environment:
name: "starlight-nestjs"
url: ${{ vars.URL }}
steps:
- name: Download build artifact
uses: actions/download-artifact@v4
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
run-id: ${{ github.event.workflow_run.id }}
name: boilerplate-build
path: .
- name: Decode and create .env file
run: |
echo ${{ secrets.ENV }} | base64 -d > .env.nestsjs
- name: Copy Artifacts to server
run: |
sudo apt update && sudo apt install sshpass -y
sshpass -p ${{ secrets.PASSWORD }} scp -o StrictHostKeyChecking=no boilerplate.tar.gz .env.nestsjs ${{ secrets.USERNAME }}@${{ secrets.HOST }}:/tmp/nestsjs
rm -f boilerplate.tar.gz .env.nestsjs
- name: Deploy on server
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }}
password: ${{ secrets.PASSWORD }}
script: |
cd /home/bingofe/boilerplate
rm -rf *
tar -xzf /tmp/nestsjs/boilerplate.tar.gz
mv /tmp/nestsjs/.env.nestsjs .env
rm -f /tmp/nestsjs/boilerplate.tar.gz
cp -r .next/standalone/* .
pm2 restart nestsjs-boilerplate --update-env