Skip to content

CI/CD Workflow

CI/CD Workflow #164

Workflow file for this run

name: CI/CD Workflow
on:
push:
branches:
- master
workflow_dispatch:
schedule:
- cron: '30 4 * * *'
jobs:
build-and-deploy:
runs-on: self-hosted
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Node and Hugo versions
run: |
node --version
hugo version
- name: Execute Variables and Build
env:
API_URL: ${{ vars.API_URL }}
AUTH_TOKEN: ${{ vars.AUTH_TOKEN }}
BASE_URL: ${{ vars.BASE_URL }}
CLEAN_URL_FIELD: ${{ vars.CLEAN_URL_FIELD }}
EVENTS_PROJECT_ID: ${{ vars.EVENTS_PROJECT_ID }}
EVENT_CANCELLED_FIELD: ${{ vars.EVENT_CANCELLED_FIELD }}
HUGO_VERSION: ${{ vars.HUGO_VERSION }}
LOCATION_FIELD: ${{ vars.LOCATION_FIELD }}
NEWS_PROJECT_ID: ${{ vars.NEWS_PROJECT_ID }}
PRESS_PROJECT_ID: ${{ vars.PRESS_PROJECT_ID }}
run: |
npm install
node create_md_files/createMdFile.js && hugo --cacheDir /tmp/hugo_cache_ubh/
- name: Archive build artifacts
run: |
tar -czvf www.unblock.health_dist.tar.gz public
- name: Copy build artifacts to the production server
run: |
scp -P22 -o StrictHostKeyChecking=no www.unblock.health_dist.tar.gz "${{ secrets.PRODUCTION_USER }}@${{ secrets.PRODUCTION_SERVER_IP }}:"
ssh -p22 -o StrictHostKeyChecking=no -t ${{ secrets.PRODUCTION_USER }}@${{ secrets.PRODUCTION_SERVER_IP }} "bash -i update-unblock-health-com.sh"