Deploy the website using GitHub Actions

This commit is contained in:
Oliver Davies 2024-09-12 19:58:53 +01:00
parent 8d3a2697d1
commit 7ba3d7ce84

38
.github/workflows/main.yaml vendored Normal file
View file

@ -0,0 +1,38 @@
---
name: Build and Deploy
on:
push:
branches:
- main
jobs:
build_and_deploy:
runs-on: ubuntu-latest
steps:
- uses: cachix/install-nix-action@v26
with:
nix_path: nixpkgs=channel:nixos-unstable
- uses: actions/checkout@v4
- name: Install dependencies
run: nix develop --command composer install
- name: Generate the website
run: |
nix develop --command ./run generate
tree output_prod
env:
APP_ENV: production
NODE_ENV: production
- name: Install the deploy key and known hosts
run: |
mkdir -p ~/.ssh && chmod 700 ~/.ssh
echo "${{ secrets.SSH_DEPLOY_KEY }}" > ~/.ssh/deploy && chmod 600 ~/.ssh/deploy
echo "${{ secrets.SSH_KNOWN_HOSTS }}" > ~/.ssh/known_hosts && chmod 600 ~/.ssh/known_hosts
- name: Deploy the website
run: ssh -i ~/.ssh/deploy zet-oliverdavies-uk@ssh.oliverdavies.uk