-
-
Notifications
You must be signed in to change notification settings - Fork 73
68 lines (63 loc) · 1.81 KB
/
build-push.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
name: Build app and deploy docker
on:
push:
branches:
- "production"
jobs:
build-webapp:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v2
# Build the app using nodejs
- name: Use node js 15
uses: actions/setup-node@v2
with:
node-version: '15'
- name: Install dependencies
run: npm install
- name: Build for production
run: npm run build
# Upload the dist directory
- uses: actions/upload-artifact@master
with:
name: Webapp artifacts
path: dist/
push-to-docker:
needs: build-webapp
runs-on: ubuntu-latest
steps:
# Checkout the repo in order to fetch the latest content
- name: Checkout repo
uses: actions/checkout@v2
- name: Download built artifact
uses: actions/download-artifact@master
with:
name: Webapp artifacts
path: ./dist/
# Login to ghcr
- name: Login to GitHub Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.CR_PAT }}
# Build the docker image now
- name: Build and push
uses: docker/build-push-action@v2
with:
context: .
push: true
tags: ghcr.io/deepjyoti30/ytmdl-web:latest
deploy:
needs: push-to-docker
runs-on: ubuntu-latest
steps:
# SSH into the server
- name: SSH into server
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.SERVER_IP }}
username: ${{ secrets.SERVER_USERNAME }}
key: ${{ secrets.KEY }}
script: /bin/bash Scripts/deploy_ytmdl_web.sh ghcr.io/deepjyoti30/ytmdl-web:latest