Skip to content

Build and deploy #35413

Build and deploy

Build and deploy #35413

Workflow file for this run

name: Build and deploy
on:
workflow_dispatch:
push:
schedule:
- cron: "0 * * * *"
jobs:
build-and-deploy:
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v4
with:
persist-credentials: false
- uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.8.6"
- name: Build
run: |
pip install -r ./requirements.txt
python site.py build
env:
MAPBOX_TOKEN: ${{ secrets.MAPBOX_TOKEN }}
- name: Clone bartek/hfxbenches
uses: actions/checkout@v4
with:
repository: bartek/hfxbenches
path: ./hfxbenches
- name: Copy hfxbenches GeoJSON to build directory
run: |
cp hfxbenches/data.geojson build/static/hfxbenches.geojson
- name: Clone bartek/hfxbikeparking
uses: actions/checkout@v4
with:
repository: bartek/hfxbikeparking
path: ./hfxbikeparking
- name: Copy hfxbikeparking GeoJSON to build directory
run: |
cp hfxbikeparking/data.geojson build/static/hfxbikeparking.geojson
- name: Upload to droplet
shell: bash
run: |
mkdir -p ~/.ssh
touch ~/.ssh/id_rsa ~/.ssh/known_hosts
chmod 700 ~/.ssh
chmod 600 ~/.ssh/id_rsa ~/.ssh/known_hosts
echo "${{ secrets.SSH_PRIVATE_KEY }}" > ~/.ssh/id_rsa
echo "${{ secrets.SSH_KNOWN_HOSTS }}" > ~/.ssh/known_hosts
scp \
-o StrictHostKeyChecking=yes \
-P ${{ secrets.SSH_PORT }} \
-o CheckHostIP=no \
-r build/* \
bartekc@${{ secrets.SSH_HOST }}:/home/bartekc/justbartek.ca