-
Notifications
You must be signed in to change notification settings - Fork 0
30 lines (30 loc) · 1.06 KB
/
main.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
name: Epitome CI/CD
on:
push:
branches:
- master
- test/gh-actions
jobs:
deploy:
name: Deploy to Raspberry Pi 4 (self-hosted) 🦖
env:
TOKEN: ${{ secrets.TOKEN }}
CLIENT_ID: ${{ secrets.CLIENT_ID }}
runs-on: self-hosted
steps:
- name: Check out repository code
uses: actions/checkout@v4
- name: Install npm dependencies with yarn
run: yarn
- name: Build epitome (/dist)
run: yarn run build
- name: Stop previous epitome pm2 process
run: pm2 delete epitome 2> /dev/null || true
- name: Prepare application directory
run: rm -rf ~/apps/epitome && mkdir ~/apps/epitome
- name: Move build contents & dependencies to application directory
run: mv dist/* ~/apps/epitome && mv node_modules ~/apps/epitome
- name: Export token and client id as environment variables
run: export TOKEN=$TOKEN && export CLIENT_ID=$CLIENT_ID
- name: Start new epitome pm2 process
run: cd ~/apps/epitome && pm2 start -f index.js --name epitome && pm2 save