forked from hngprojects/hng_boilerplate_nextjs
-
Notifications
You must be signed in to change notification settings - Fork 0
65 lines (57 loc) · 1.98 KB
/
kimiko-golang-deployment.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
name: Kimiko Golang Deployment
on:
workflow_dispatch:
workflow_run:
workflows: ["Build and Upload"]
types:
- completed
jobs:
deploy_boilerplate_frontend:
if: ${{ github.event.workflow_run.conclusion == 'success' }}
runs-on: ubuntu-latest
environment:
name: "kimiko-golang"
url: ${{ vars.URL }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
- 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: Create .env
uses: vicradon/create-env-action@v1.0.1
with:
action_input_file: ".env.sample"
action_output_file: ".env"
API_URL: ${{ vars.API_URL }}
NEXTAUTH_URL: ${{ vars.URL }}
GOOGLE_CLIENT_ID: ${{ secrets.GOOGLE_CLIENT_ID }}
TWITTER_CLIENT_ID: ${{ secrets.TWITTER_CLIENT_ID }}
GOOGLE_CLIENT_SECRET: ${{ secrets.GOOGLE_CLIENT_SECRET }}
TWITTER_CLIENT_SECRET: ${{ secrets.TWITTER_CLIENT_SECRET }}
AUTH_SECRET: ${{ secrets.AUTH_SECRET }}
- name: Copy Artifacts to server
uses: appleboy/scp-action@v0.1.7
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }}
password: ${{ secrets.PASSWORD }}
source: ".env,boilerplate.tar.gz"
target: "~/deployments/hng_boilerplate_nextjs"
- name: Deploy on server
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }}
password: ${{ secrets.PASSWORD }}
script: |
cd ~/deployments/hng_boilerplate_nextjs
tar -xzf boilerplate.tar.gz
rm -f boilerplate.tar.gz
git reset --hard
git pull origin dev
pm2 restart boilerplate-frontend --update-env