Skip to content

chore: updated projects #52

chore: updated projects

chore: updated projects #52

Workflow file for this run

# This workflow will deploy the application to the production server
name: CD pipeline
on:
push:
branches:
- main
- develop
jobs:
avoid-reduncy:
runs-on: ubuntu-latest
permissions:
actions: write
steps:
- name: Cancel previous redundant builds
uses: styfle/cancel-workflow-action@0.9.1
with:
access_token: ${{ github.token }}
build:
runs-on: ubuntu-latest
steps:
- name: Extract branch name
shell: bash
run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})"
id: extract_branch
- name: Deploy using ssh
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.SSH_HOST }}
username: ${{ secrets.SSH_USERNAME }}
key: ${{ secrets.SSH_PRIVATE_KEY }}
port: 22
script_stop: true
command_timeout: 15m
script: |
if [ "${{ steps.extract_branch.outputs.branch }}" == "main" ]; then cd ~/portfolio; fi
if [ "${{ steps.extract_branch.outputs.branch }}" == "develop" ]; then cd ~/portfolio-staging; fi
git pull
git status
export NVM_DIR=~/.nvm
source ~/.nvm/nvm.sh
npm i
npm run build