forked from donggukthonN/donggukthon_2023_11_F
-
Notifications
You must be signed in to change notification settings - Fork 0
66 lines (53 loc) · 1.76 KB
/
npm-publish.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
name: client-actions
on:
push:
branches: [ "main" ]
jobs:
ci:
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Cache Node.js modules
uses: actions/cache@v2
with:
path: |
node_modules
~/.cache/yarn
key: ${{ runner.os }}-node-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-node-
- name: Use Node.js
uses: actions/setup-node@v2
with:
node-version: '20'
- name: Install Yarn
run: npm install -g yarn
- name: Install dependencies
run: yarn install
- name: Add Babel plugin
run: yarn add @babel/plugin-proposal-private-property-in-object --dev
- name: Build
run: yarn build
env:
CI: false
- name: Docker build & push to hub
run: |
docker login -u ${{ secrets.DOCKERHUB_USERNAME }} -p ${{ secrets.DOCKERHUB_PASSWORD }}
docker build -f Dockerfile -t ${{ secrets.DOCKERHUB_USERNAME }}/${{ secrets.DOCKERHUB_REPONAME }}:latest .
docker push ${{ secrets.DOCKERHUB_USERNAME }}/${{ secrets.DOCKERHUB_REPONAME }}:latest
cd:
needs: [ci]
runs-on: ubuntu-20.04
steps:
- name: Docker Image Pull and Compose UP
uses: appleboy/[email protected]
with:
host: ${{ secrets.HOST }}
username : ${{ secrets.USERNAME }}
key : ${{ secrets.PRIVATE_KEY }}
script: |
sudo docker compose down
sudo docker pull ${{ secrets.DOCKERHUB_USERNAME }}/${{ secrets.DOCKERHUB_REPONAME }}:latest
docker compose up -d
docker image prune -f