From 7ba3d7ce84137f12da4213b3b430f8c87124d3ce Mon Sep 17 00:00:00 2001 From: Oliver Davies Date: Thu, 12 Sep 2024 19:58:53 +0100 Subject: [PATCH] Deploy the website using GitHub Actions --- .github/workflows/main.yaml | 38 +++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 .github/workflows/main.yaml diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml new file mode 100644 index 0000000..12990df --- /dev/null +++ b/.github/workflows/main.yaml @@ -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