Deploy dev #56
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Pre-requisites | |
# | |
# You need either to have set the following environment secrets: | |
# | |
# DEPLOY_KEY - Private key for an SSH key with (at least) read only access to the bradford-2025/open-data-pipelines project | |
# The deploy key is one of the ones set in https://github.com/bradford-2025/open-data-pipelines/settings/keys | |
# | |
# SSH_HOST - host to deploy the site to | |
# SSH_USER - user for deployment | |
# SSH_PASS - password for the user | |
# SSH_PATH - path on the host to deploy to | |
name: Deploy dev | |
"on": | |
workflow_dispatch: {} | |
push: | |
branches: [dev] | |
paths: | |
- src/** | |
- data/**/*.dvc | |
- pipelines/** | |
- _config.ts | |
- deno.json | |
- .github/workflows/deploy-dev.yml | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
# Build job | |
dev-build: | |
if: github.ref == 'refs/heads/dev' | |
runs-on: ubuntu-latest | |
env: | |
DENO_DIR: /var/tmp/deno_cache | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Setup python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.12" | |
cache: pipenv | |
- name: Setup pipenv | |
run: | | |
pip install pipenv | |
pipenv install | |
- name: Setup deno | |
uses: denoland/setup-deno@v2 | |
with: | |
deno-version: v2.x | |
- name: Cache Deno dependencies | |
id: cache-deno | |
uses: actions/cache@v4 | |
with: | |
key: deno-cache-${{ hashFiles('./deno.lock') }} | |
path: ${{ env.DENO_DIR }} | |
- name: Get current data | |
run: | | |
umask 077 | |
eval $(ssh-agent -s) | |
echo "${{ secrets.DEPLOY_KEY }}" > deploy-key | |
ssh-add deploy-key | |
pipenv run dvc update data/published.dvc data/metadata.dvc | |
ssh-add -D | |
echo "${{ secrets.DEPLOY_KEY_HUQ }}" > deploy-key-huq | |
ssh-add deploy-key-huq | |
pipenv run dvc update data/huq.dvc | |
ssh-add -D | |
- name: Run pipelines | |
run: | | |
pipenv run dvc repro pipelines/dvc.yaml | |
- name: Build the dev site | |
run: deno task build:dev | |
- name: Deploy the dev site to bytemark | |
run: | | |
# apt update | |
# apt install -y rsync sshpass | |
deno task deploy:dev | |
env: | |
SSH_HOST: ${{ secrets.SSH_HOST }} | |
SSH_PATH: ${{ secrets.SSH_PATH }} | |
SSH_USER: ${{ secrets.SSH_USER }} | |
SSHPASS: ${{ secrets.SSH_PASS }} |