This repository has been archived by the owner on Apr 23, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 943
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
dc56da1
commit 0b3c69f
Showing
2 changed files
with
104 additions
and
104 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |