Files
coriolis/.github/workflows/autodeploy.yml
Alex Williams f7cab2e96a deployment fix
2024-06-21 20:39:14 +01:00

40 lines
1.4 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 start
cd ../coriolis
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