Skip to content

build.yml add ssh to deploy step #105

build.yml add ssh to deploy step

build.yml add ssh to deploy step #105

Workflow file for this run

# This workflow will do a clean installation 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: Build
on:
push:
branches: ["master"]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
with:
node-version: 20
- name: ssh tunnel to mysql database
run: |
mkdir -p ~/.ssh/
ssh-keyscan -H ara.uberspace.de >> ~/.ssh/known_hosts
eval `ssh-agent -s`
ssh-add - <<< "${{secrets.SSH_PRIVATE_KEY}}"
ssh -fN -L 3306:127.0.0.1:3306 [email protected]
- name: Install
run: npm install
- name: Build
run: npm run build
- name: zip
run: zip -r build.zip .next
- name: Archive production artifacts
uses: actions/upload-artifact@v3
with:
name: build-data
path: build.zip
deploy-beta:
needs: build
runs-on: ubuntu-latest
steps:
- name: Download build artifacts
uses: actions/download-artifact@v3
with:
name: build-data
- name: ssh tunnel for upload
run: |
mkdir -p ~/.ssh/
ssh-keyscan -H ara.uberspace.de >> ~/.ssh/known_hosts
eval `ssh-agent -s`
ssh-add - <<< "${{secrets.SSH_PRIVATE_KEY}}"
ssh -fN -L 3306:127.0.0.1:3306 [email protected]
- name: upload
run: |
ssh-keyscan -H ara.uberspace.de >> ~/.ssh/known_hosts
eval `ssh-agent -s`
ssh-add - <<< "${{secrets.SSH_PRIVATE_KEY}}"
scp build.zip [email protected]:~/html/HEAD/
ssh [email protected] 'rm -rf ~/html/HEAD/.next'
ssh [email protected] 'unzip -d ~/html/HEAD/ ~/html/HEAD/build.zip'
ssh [email protected] 'supervisorctl stop beta'
ssh [email protected] '/home/duostori/html/kill_rouge_workers.py'
ssh [email protected] '/home/duostori/html/kill_port_users.py beta'
ssh [email protected] 'supervisorctl start beta'