Skip to content

Field Day Website - CI Script - Merge pull request #40 from fielddaylab/feature/FD-66 FD-66: Add home page carousel #7

Field Day Website - CI Script - Merge pull request #40 from fielddaylab/feature/FD-66 FD-66: Add home page carousel

Field Day Website - CI Script - Merge pull request #40 from fielddaylab/feature/FD-66 FD-66: Add home page carousel #7

Workflow file for this run

name: Field Day Website - CI Script
run-name: ${{ format('{0} - {1}', github.workflow, github.event_name == 'push' && github.event.head_commit.message || 'Manual Run') }}
on:
workflow_dispatch: # Allow manual trigger of this workflow from the Actions tab
push: # Trigger automatically when we do a push to the site.
branches: [release/home-redesign]
env:
DEPLOY_HOST: "wwwtest.fielddaylab.wisc.edu"
DEPLOY_DIR: "/httpdocs"
DEPLOY_URL: "https://wwwtest.fielddaylab.wisc.edu/"
jobs:
ci_deploy:
name: CI Deploy of Field Day Website
runs-on: ubuntu-22.04
concurrency:
group: ${{ github.repository }}-${{ github.ref }}-${{ github.workflow }}
cancel-in-progress: true
steps:
# 1. Local checkout & config
- name: Announce Run
run: echo "Deploying ${{ github.repository }} to ${{ env.DEPLOY_URL }} via ${{ github.actor }}"
- name: Checkout repository
uses: actions/checkout@v3
with:
lfs: true
# 2. Build
- name: Install Node
uses: actions/setup-node@v3
with:
node-version: 16
- name: Install libraries
run: npm install
- name: Build
run: gulp compileSass
# 3. Remote config & deploy
- name: Install OpenConnect
run: sudo apt-get -q update && sudo apt-get -q install openconnect
- name: Connect to VPN
run: echo ${{ secrets.FIELDDAY_VPN_PASSWORD }} | sudo openconnect --protocol=gp -u ${{ secrets.FIELDDAY_VPN_USERNAME}} --passwd-on-stdin soe.vpn.wisc.edu &
- name: Setup Access Key
run: |
mkdir -p ~/.ssh
echo '${{secrets.FIELDDAY_WISC_EDU_DEPLOY_KEY}}' >> ./key.txt
chmod 600 ./key.txt
- name: Ensure directory exists
run: ssh -o StrictHostKeyChecking=no -T -i ./key.txt ${{ secrets.FIELDDAY_VPN_USERNAME }}@${{ env.DEPLOY_HOST }} "mkdir -p ${{ env.DEPLOY_DIR }}"
- name: Upload to web server via rsync
uses: burnett01/[email protected]
with:
# switches:
# -v : verbose output
# -r : recurse into subdirectories
# -c : use checksum to determine what files to update/skip
# -t : preserve modification times
# --delete : delete extraneous files from destination directories
# --exclude-from : skip any files in rsync-exclude
# --chmod : For each directory (D) and file (F), give user (u) and group (g) rwx permissions.
# Give others (o) only read permissions, plus execute for directories.
switches: -vrct --delete --exclude-from 'rsync-exclude' --chmod=Du=rwx,Dg=rwx,Do=rx,Fu=rwx,Fg=rwx,Fo=r
path: ./*
remote_path: ${{ env.DEPLOY_DIR }}
remote_host: ${{ env.DEPLOY_HOST }}
remote_user: ${{ secrets.FIELDDAY_WISC_EDU_DEPLOY_USER }}
remote_key: ${{ secrets.FIELDDAY_WISC_EDU_DEPLOY_KEY }}
# 4. Cleanup & complete
- name: Announce deploy
run: echo "Deployed to ${{ env.DEPLOY_URL }}"
- name: Upload logs as artifacts
uses: actions/upload-artifact@v2
with:
path: ./*.log