Skip to content

rename google community to slack #40

rename google community to slack

rename google community to slack #40

name: OGD-Website Release Script
# Controls when the action will run. Triggers the workflow on creation of
# tags. Creating new 'versions' via github is the most straightforward
# way of doing this.
on:
workflow_dispatch: # Allow manual trigger of this workflow from the Actions tab
#create:
# tags:
# - '*'
push: # Trigger automatically when we do a merge to production
branches: [ production ]
env:
DEPLOY_HOST: ${{ vars.OGD_SERVICES_HOST }}
DEPLOY_DIR: ${{ vars.WEB_PATH }}/opengamedata/
DEPLOY_URL: ${{ vars.OGD_SERVICES_HOST }}/opengamedata/
URL_PATH: /opengamedata/
SECONDARY_HOST: fieldday-web.wcer.wisc.edu
SECONDARY_PATH: /var/www/opengamedata/
API_HOST: ${{ vars.OGD_SERVICES_HOST }}
API_PATH: wsgi-bin/opengamedata-website-api/production/app.wsgi/
# TODO : Someday, switch this to just opengamedata-website-api, leave out production from path on services.
jobs:
production_deploy:
name: Release Deploy of Website
runs-on: ubuntu-22.04
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
steps:
# 1. Local checkout & config
- name: Checkout repository
uses: actions/checkout@v3
with:
lfs: true
- name: Set up Config File
uses: ./.github/actions/web_config
with:
api_base: https://${{env.API_HOST}}/${{env.API_PATH}}
# 2. Build
- name: Install Node
uses: actions/setup-node@v3
with:
node-version: 16
- name: Install libraries
run: npm install
- name: Build
run: gulp build
# 3. Remote config & deploy
- name: Install OpenConnect
run: sudo apt-get -q update && sudo apt-get -q install openconnect |
sudo pip3 install https://github.com/dlenski/vpn-slice/archive/master.zip
- name: Connect to VPN
run: echo ${{ secrets.VPN_PASS }} | sudo openconnect --protocol=gp -u ${{ secrets.VPN_USER}} --passwd-on-stdin soe.vpn.wisc.edu &
- name: Setup Access Key
run: |
mkdir -p ~/.ssh
echo '${{secrets.VPN_KEY}}' >> ./key.txt
chmod 600 ./key.txt
# - name: Ensure directory exists
# run: ssh -o StrictHostKeyChecking=no -T -i ./key.txt ${{ secrets.DEPLOY_USER }}@${{ env.DEPLOY_HOST }} "mkdir -p ${{ env.DEPLOY_DIR }}"
- name: Ensure directory exists
run: ssh -o StrictHostKeyChecking=no -T -i ./key.txt ${{ secrets.VPN_USER }}@${{ env.SECONDARY_HOST }} "mkdir -p ${{ env.SECONDARY_PATH }}"
# - name: Upload to web server via rsync
# uses: burnett01/[email protected]
# with:
# switches: -vrct --delete --exclude-from 'rsync-exclude'
# path: /site/*
# remote_path: ${{ env.DEPLOY_DIR }}
# remote_host: ${{ env.DEPLOY_HOST }}
# remote_user: ${{ secrets.DEPLOY_USER }}
# remote_key: ${{ secrets.DEPLOY_KEY }}
- name: Upload to secondary web server via rsync
uses: burnett01/[email protected]
with:
switches: -vrc --exclude-from 'rsync-exclude'
path: /site/*
remote_path: ${{ env.SECONDARY_PATH }}
remote_host: ${{ env.SECONDARY_HOST }}
remote_user: ${{ secrets.VPN_USER }}
remote_key: ${{ secrets.VPN_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