Files
coriolis/.github/workflows/autodeploy.yml
2024-06-22 10:48:20 +01:00

44 lines
1.5 KiB
YAML

# This is a basic deployment workflow triggered by pushes to the beta and live branches.
name: Auto-Deploy 'beta/live' Branch to beta.coliolis.io or coriolis.io
# Controls when the action will run. Workflow runs when the alpha branch receives a push event
on:
push:
branches:
- beta
- live
# Figure out the target branch name
env:
BRANCH_NAME: ${{ github.base_ref || github.ref_name }}
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
deploy:
runs-on: self-hosted
steps:
- name: Download the code
shell: bash
run: |
rm -Rf ./coriolis
rm -Rf ./coriolis-data
git clone https://github.com/Brighter-Applications/coriolis.git --single-branch --branch ${BRANCH_NAME}
git clone https://github.com/Brighter-Applications/coriolis-data.git --single-branch --branch ${BRANCH_NAME}
- name: Build the code
shell: bash
run: |
cd coriolis-data
export NVM_DIR=~/.nvm
source ~/.nvm/nvm.sh
npm install
npm audit fix
npm start
cd ../coriolis
npm install
npm audit fix
npm run build
- name: Deploy the code
shell: bash
run: |
cd ../coriolis
if [ {BRANCH_NAME} == "beta" ]; then sudo -u www-data cp -r ./build/* /var/www/beta.coriolis.io/; else sudo -u www-data cp -r ./build/* /var/www/coriolis.io/; fi