mirror of
https://github.com/EDCD/coriolis.git
synced 2025-12-10 07:05:35 +00:00
Shifting node build to separate runner
This commit is contained in:
41
.github/workflows/autodeploy.yml
vendored
41
.github/workflows/autodeploy.yml
vendored
@@ -11,10 +11,12 @@ on:
|
|||||||
# Figure out the target branch name
|
# Figure out the target branch name
|
||||||
env:
|
env:
|
||||||
BRANCH_NAME: ${{ github.base_ref || github.ref_name }}
|
BRANCH_NAME: ${{ github.base_ref || github.ref_name }}
|
||||||
|
TARGET_ZIP: build.zip
|
||||||
|
BUCKET_FOLDER: build
|
||||||
# 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:
|
||||||
deploy:
|
build:
|
||||||
runs-on: self-hosted
|
runs-on: builder
|
||||||
steps:
|
steps:
|
||||||
- name: Download the code
|
- name: Download the code
|
||||||
shell: bash
|
shell: bash
|
||||||
@@ -34,8 +36,39 @@ jobs:
|
|||||||
cd ../coriolis
|
cd ../coriolis
|
||||||
npm install 2>&1
|
npm install 2>&1
|
||||||
npm run build 2>&1
|
npm run build 2>&1
|
||||||
- name: Deploy the code
|
- name: Zip the code
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
cd ../coriolis
|
cd ../coriolis
|
||||||
if [ {BRANCH_NAME} == "beta" ]; then sudo rm -Rf /var/www/beta.coriolis.io/* && sudo -u www-data cp -r ./build/* /var/www/beta.coriolis.io/; else sudo rm -Rf /var/www/coriolis.io/* && sudo -u www-data cp -r ./build/* /var/www/coriolis.io/; fi
|
zip -r ${TARGET_ZIP}.zip ./build/*
|
||||||
|
- name: Authorize GCP
|
||||||
|
uses: google-github-actions/auth@v2
|
||||||
|
with:
|
||||||
|
credentials_json: ${{ secrets.CORIOLIS_GCP_SA_KEY }}
|
||||||
|
- name: Set up Cloud SDK
|
||||||
|
uses: google-github-actions/setup-gcloud@v2
|
||||||
|
with:
|
||||||
|
version: '>=363.0.0'
|
||||||
|
project_id: ${{ secrets.GCP_PROJECT_ID }}
|
||||||
|
- name: Upload to Google Cloud Storage
|
||||||
|
run: |-
|
||||||
|
TARGET_ZIP=${{ env.TARGET_ZIP }}
|
||||||
|
BUCKET_PATH=${{ secrets.CORIOLIS_GCP_TARGET_BUCKET }}/${{ env.BUCKET_FOLDER }}
|
||||||
|
EXTENSION="${TARGET_ZIP##*.}"
|
||||||
|
FILENAME="${TARGET_ZIP%.*}"
|
||||||
|
LATEST_FILENAME="${FILENAME}_latest.${EXTENSION}"
|
||||||
|
gsutil cp ./$TARGET_ZIP gs://${BUCKET_PATH}/${LATEST_FILENAME}
|
||||||
|
deploy:
|
||||||
|
runs-on: webapp
|
||||||
|
needs: build
|
||||||
|
steps:
|
||||||
|
- name: Download and unzip the build
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
mkdir ./build/
|
||||||
|
gsutil cp gs://${{ secrets.CORIOLIS_GCP_TARGET_BUCKET }}/${{ env.BUCKET_FOLDER }}/${TARGET_ZIP}_latest.zip ./build/${TARGET_ZIP}_latest.zip
|
||||||
|
unzip ./build/${TARGET_ZIP}_latest.zip -d ./build/
|
||||||
|
- name: Move the build to the web server
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
if [ ${{ env.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
|
||||||
Reference in New Issue
Block a user