convert back to old one #49
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 workflow will do a clean install of node dependencies, cache/restore them, build the source code and run tests across different versions of node | |
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions | |
name: Deploy live Site bsc subdomain | |
on: | |
push: | |
branches: [main-bsc] | |
workflow_dispatch: | |
env: | |
BSC_WORK_PATH: bsc-interface | |
defaults: | |
run: | |
shell: bash | |
working-directory: bsc-interface | |
jobs: | |
setup_and_build: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [self-hosted] | |
node: [16] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@master | |
with: | |
ref: 'main-bsc' | |
path: ${{env.BSC_WORK_PATH}} | |
- name: Setup Node.js ${{ matrix.node }} | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ matrix.node }} | |
cache: 'npm' | |
cache-dependency-path: '**/package-lock.json' | |
- name: Install dependencies | |
run: | | |
cp .env.production .env | |
npm ci | |
- name: Build | |
run: CI=false npm run build | |
- name: Cache node_modules | |
uses: actions/cache@v2 | |
continue-on-error: true | |
with: | |
path: | | |
${{ github.workspace }}/${{ github.ref_name }}/node_modules | |
key: ${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-nextjs- | |
copy_files: | |
needs: setup_and_build | |
runs-on: self-hosted | |
steps: | |
- name: rsync | |
run: | | |
rsync -av ${{ github.workspace }}/${{ github.repo }}${{env.BSC_WORK_PATH}}/ ${{ secrets.BSC_SERVER_LOCATION }} | |
deploy_pm2: | |
needs: copy_files | |
runs-on: self-hosted | |
steps: | |
- name: pm2 | |
run: | | |
cd ${{ secrets.BSC_SERVER_LOCATION }} | |
pm2 delete BSC-interface || : && pm2 start npm --name "BSC-interface" -- start --watch | |
pm2 save |