Making autodeploy aware of its target branch name (#16)

This commit is contained in:
Alex Williams
2024-06-21 09:09:05 +01:00
committed by GitHub
parent 69790d970a
commit b5b42ddb26

View File

@@ -1,15 +1,17 @@
# This is a basic deployment workflow triggered by pushes to the alpha branch. # 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
name: Auto-Deploy 'live' Branch to coliolis.io
# Controls when the action will run. Workflow runs when the alpha branch receives a push event # Controls when the action will run. Workflow runs when the alpha branch receives a push event
on: on:
workflow_dispatch: workflow_dispatch:
push: push:
branches: branches:
- beta
- live - 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 # A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs: jobs:
downloadcode: downloadcode:
@@ -19,8 +21,8 @@ jobs:
run: | run: |
rm -Rf ./coriolis rm -Rf ./coriolis
rm -Rf ./coriolis-data rm -Rf ./coriolis-data
git clone https://github.com/Brighter-Applications/coriolis.git --single-branch --branch live 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 live git clone https://github.com/Brighter-Applications/coriolis-data.git --single-branch --branch ${BRANCH_NAME}
cd coriolis-data cd coriolis-data
export NVM_DIR=~/.nvm export NVM_DIR=~/.nvm
source ~/.nvm/nvm.sh source ~/.nvm/nvm.sh
@@ -28,4 +30,4 @@ jobs:
cd ../coriolis cd ../coriolis
npm install npm install
npm run build npm run build
sudo -u www-data cp -r ./build/* /var/www/coriolis.io/ 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