Skip to content
This repository has been archived by the owner on Apr 23, 2024. It is now read-only.

Commit

Permalink
update deployment
Browse files Browse the repository at this point in the history
  • Loading branch information
mgilangjanuar committed Dec 17, 2021
1 parent dc56da1 commit 0b3c69f
Show file tree
Hide file tree
Showing 2 changed files with 104 additions and 104 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build-prod-do.sg.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
env:
NPM_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
- run: yarn install
- run: REACT_APP_API_URL=https://sg.teledriveapp.com GENERATE_SOURCEMAP=false yarn workspaces run build
- run: REACT_APP_API_URL=https://teledriveapp.com GENERATE_SOURCEMAP=false yarn workspaces run build
- name: Compress node_modules root
if: ${{ github.event_name == 'push' }}
run: tar -czf build-root.tar.gz node_modules
Expand Down Expand Up @@ -93,7 +93,7 @@ jobs:
message: |
🎉 *Deployed to Production*
Please take a look -> https://sg.teledriveapp.com
Please take a look -> https://teledriveapp.com
format: markdown
- name: Failed Notification
if: ${{ failure() }}
Expand Down
204 changes: 102 additions & 102 deletions .github/workflows/build-prod.yml
Original file line number Diff line number Diff line change
@@ -1,108 +1,108 @@
on:
push:
branches:
- main
# on:
# push:
# branches:
# - main

name: Build Prod
# name: Build Prod

env:
APP_DIR: /home/mgilangjanuar/teledrive
SERVER_NODE_VERSION: v14.17.6
DEV_USER: mgilangjanuar
DEV_HOST: 34.87.70.100
# env:
# APP_DIR: /home/mgilangjanuar/teledrive
# SERVER_NODE_VERSION: v14.17.6
# DEV_USER: mgilangjanuar
# DEV_HOST: 34.87.70.100

jobs:
build:
name: Build
runs-on: ubuntu-latest
# jobs:
# build:
# name: Build
# runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Use Node.js
uses: actions/setup-node@v1
with:
node-version: '14.x'
- name: Add npmrc
run: echo -e "//npm.pkg.github.com/:_authToken=${NPM_AUTH_TOKEN}\n@mgilangjanuar:registry=https://npm.pkg.github.com/" > ~/.npmrc && cat ~/.npmrc
env:
NPM_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
- run: yarn install
- run: REACT_APP_API_URL=https://teledriveapp.com GENERATE_SOURCEMAP=false yarn workspaces run build
- name: Compress node_modules root
if: ${{ github.event_name == 'push' }}
run: tar -czf build-root.tar.gz node_modules
- name: Compress node_modules & dist server
if: ${{ github.event_name == 'push' }}
run: tar -czf build-server.tar.gz server/node_modules server/dist
- name: Compress node_modules & build web
if: ${{ github.event_name == 'push' }}
run: tar -czf build-web.tar.gz web/node_modules web/build
- name: Upload build-root.tar.gz
uses: appleboy/scp-action@master
with:
source: build-root.tar.gz
target: ${{ env.APP_DIR }}
host: ${{ env.DEV_HOST }}
username: ${{ env.DEV_USER }}
key: ${{ secrets.SSH_SECRET }}
debug: true
- name: Upload build-server.tar.gz
uses: appleboy/scp-action@master
with:
source: build-server.tar.gz
target: ${{ env.APP_DIR }}
host: ${{ env.DEV_HOST }}
username: ${{ env.DEV_USER }}
key: ${{ secrets.SSH_SECRET }}
- name: Upload build-web.tar.gz
uses: appleboy/scp-action@master
with:
source: build-web.tar.gz
target: ${{ env.APP_DIR }}
host: ${{ env.DEV_HOST }}
username: ${{ env.DEV_USER }}
key: ${{ secrets.SSH_SECRET }}
- name: Extract build-root.tar.gz
uses: appleboy/ssh-action@master
with:
script: cd ${{ env.APP_DIR }} && rm -rf node_modules && tar -xzf build-root.tar.gz && rm -rf build-root.tar.gz
host: ${{ env.DEV_HOST }}
username: ${{ env.DEV_USER }}
key: ${{ secrets.SSH_SECRET }}
- name: Extract build-web.tar.gz
if: ${{ github.event_name == 'push' }}
uses: appleboy/ssh-action@master
with:
script: cd ${{ env.APP_DIR }}/web && rm -rf node_modules && rm -rf build && cd .. && tar -xzf build-web.tar.gz && rm -rf build-web.tar.gz
host: ${{ env.DEV_HOST }}
username: ${{ env.DEV_USER }}
key: ${{ secrets.SSH_SECRET }}
- name: Extract build-server.tar.gz
if: ${{ github.event_name == 'push' }}
uses: appleboy/ssh-action@master
with:
script: cd ${{ env.APP_DIR }}/server && rm -rf node_modules && rm -rf dist && cd .. && tar -xzf build-server.tar.gz && rm -rf build-server.tar.gz && git pull origin main && cd ${{ env.APP_DIR }} && /usr/bin/pm2 restart td
host: ${{ env.DEV_HOST }}
username: ${{ env.DEV_USER }}
key: ${{ secrets.SSH_SECRET }}
- name: Success Notification
uses: appleboy/telegram-action@master
with:
to: -700697945
token: ${{ secrets.TG_BOT_TOKEN }}
message: |
🎉 *Deployed to Production*
# steps:
# - uses: actions/checkout@v2
# - name: Use Node.js
# uses: actions/setup-node@v1
# with:
# node-version: '14.x'
# - name: Add npmrc
# run: echo -e "//npm.pkg.github.com/:_authToken=${NPM_AUTH_TOKEN}\n@mgilangjanuar:registry=https://npm.pkg.github.com/" > ~/.npmrc && cat ~/.npmrc
# env:
# NPM_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
# - run: yarn install
# - run: REACT_APP_API_URL=https://teledriveapp.com GENERATE_SOURCEMAP=false yarn workspaces run build
# - name: Compress node_modules root
# if: ${{ github.event_name == 'push' }}
# run: tar -czf build-root.tar.gz node_modules
# - name: Compress node_modules & dist server
# if: ${{ github.event_name == 'push' }}
# run: tar -czf build-server.tar.gz server/node_modules server/dist
# - name: Compress node_modules & build web
# if: ${{ github.event_name == 'push' }}
# run: tar -czf build-web.tar.gz web/node_modules web/build
# - name: Upload build-root.tar.gz
# uses: appleboy/scp-action@master
# with:
# source: build-root.tar.gz
# target: ${{ env.APP_DIR }}
# host: ${{ env.DEV_HOST }}
# username: ${{ env.DEV_USER }}
# key: ${{ secrets.SSH_SECRET }}
# debug: true
# - name: Upload build-server.tar.gz
# uses: appleboy/scp-action@master
# with:
# source: build-server.tar.gz
# target: ${{ env.APP_DIR }}
# host: ${{ env.DEV_HOST }}
# username: ${{ env.DEV_USER }}
# key: ${{ secrets.SSH_SECRET }}
# - name: Upload build-web.tar.gz
# uses: appleboy/scp-action@master
# with:
# source: build-web.tar.gz
# target: ${{ env.APP_DIR }}
# host: ${{ env.DEV_HOST }}
# username: ${{ env.DEV_USER }}
# key: ${{ secrets.SSH_SECRET }}
# - name: Extract build-root.tar.gz
# uses: appleboy/ssh-action@master
# with:
# script: cd ${{ env.APP_DIR }} && rm -rf node_modules && tar -xzf build-root.tar.gz && rm -rf build-root.tar.gz
# host: ${{ env.DEV_HOST }}
# username: ${{ env.DEV_USER }}
# key: ${{ secrets.SSH_SECRET }}
# - name: Extract build-web.tar.gz
# if: ${{ github.event_name == 'push' }}
# uses: appleboy/ssh-action@master
# with:
# script: cd ${{ env.APP_DIR }}/web && rm -rf node_modules && rm -rf build && cd .. && tar -xzf build-web.tar.gz && rm -rf build-web.tar.gz
# host: ${{ env.DEV_HOST }}
# username: ${{ env.DEV_USER }}
# key: ${{ secrets.SSH_SECRET }}
# - name: Extract build-server.tar.gz
# if: ${{ github.event_name == 'push' }}
# uses: appleboy/ssh-action@master
# with:
# script: cd ${{ env.APP_DIR }}/server && rm -rf node_modules && rm -rf dist && cd .. && tar -xzf build-server.tar.gz && rm -rf build-server.tar.gz && git pull origin main && cd ${{ env.APP_DIR }} && /usr/bin/pm2 restart td
# host: ${{ env.DEV_HOST }}
# username: ${{ env.DEV_USER }}
# key: ${{ secrets.SSH_SECRET }}
# - name: Success Notification
# uses: appleboy/telegram-action@master
# with:
# to: -700697945
# token: ${{ secrets.TG_BOT_TOKEN }}
# message: |
# 🎉 *Deployed to Production*

Please take a look -> https://teledriveapp.com
format: markdown
- name: Failed Notification
if: ${{ failure() }}
uses: appleboy/telegram-action@master
with:
to: -700697945
token: ${{ secrets.TG_BOT_TOKEN }}
message: |
🔥 *Deploy to Production Failed!*
# Please take a look -> https://teledriveapp.com
# format: markdown
# - name: Failed Notification
# if: ${{ failure() }}
# uses: appleboy/telegram-action@master
# with:
# to: -700697945
# token: ${{ secrets.TG_BOT_TOKEN }}
# message: |
# 🔥 *Deploy to Production Failed!*

Please take a look -> https://github.com/mgilangjanuar/teledrive/actions
format: markdown
# Please take a look -> https://github.com/mgilangjanuar/teledrive/actions
# format: markdown

0 comments on commit 0b3c69f

Please sign in to comment.