From 364fc363f082100ebc977ca2d5ef1d570bf61bd5 Mon Sep 17 00:00:00 2001 From: Max Schmidt Date: Wed, 17 May 2023 16:10:56 +0200 Subject: [PATCH] fas Signed-off-by: Max Schmidt --- .github/workflows/payload.yml | 12 +++++++++++- README.md | 7 +++---- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/.github/workflows/payload.yml b/.github/workflows/payload.yml index 1848a93..c9619c4 100644 --- a/.github/workflows/payload.yml +++ b/.github/workflows/payload.yml @@ -20,5 +20,15 @@ jobs: else mkdir ${{ secrets.PATH }} cd ${{ secrets.PATH }} - git clone -b prod https://github.com/mooxl/astroad . + git clone -b prod ${{ github.repository }} . + mv .env.dev .env.prod + sed -i "s/ASTRO_URL=.*/ASTRO_URL=${{ ASTRO_URL }}/" .env.prod + sed -i "s/PAYLOAD_URL=.*/PAYLOAD_URL=${{ PAYLOAD_URL }}/" .env.prod + sed -i "s/PAYLOAD_PORT=.*/PAYLOAD_PORT=${{ PAYLOAD_PORT }}/" .env.prod + sed -i "s/PAYLOAD_SECRET=.*/PAYLOAD_SECRET=${{ PAYLOAD_SECRET }}/" .env.prod + sed -i "s/MONGODB_URI=.*/MONGODB_URI=${{ MONGODB_URI }}/" .env.prod + sed -i "s/MONGODB_USER=.*/MONGODB_USER=${{ MONGODB_USER }}/" .env.prod + sed -i "s/MONGODB_PW=.*/MONGODB_PW=${{ MONGODB_PW }}/" .env.prod + sed -i "s/MONGODB_DB=.*/MONGODB_DB=${{ MONGODB_DB }}/" .env.prod + sed -i "s/NAME=.*/NAME=${{ NAME }}/" .env.prod fi diff --git a/README.md b/README.md index d2122af..e233a65 100644 --- a/README.md +++ b/README.md @@ -20,10 +20,9 @@ The `docker-compose.yml` and `docker-compose-dev.yml` files includes everything ## Deployment -When you're ready to deploy your website to a production environment, you'll should copy the `.env.dev` and rename it into `.env.prod`. Then you modify the file to suit your needs. This file contains the configuration for the Astro, Payload, Mongo, GitHub Workflow and Traefik. - Deployment is handled by a Github Actions Workflow on every push on branch `prod`. It logs into the server via SSH, pulls or clones the latest version of the repository, and runs `yarn prod`. - -Because Astro is completely static, a content change in the CMS must trigger a new build of Astro. Therefore, there's a `payload.yml` workflow that gets triggered by a webhook after every content change from Payload. +Because Astro is completely static, a content change in the CMS must trigger a new build of Astro. Therefore, there’s a `payload.yml` workflow that gets triggered by a webhook after every content change from Payload. Ensure you have Traefik set up as a reverse proxy before deployment. The prod script will launch your site in a production-ready environment. + +Please note that since deployment is done through Github Workflows, you need to define the necessary secrets in the settings. You can find which secrets are used in the `.github/workflows/push.yml` file. This file converts the existing `.env.dev` to `.env.prod` and adds the secrets that have already been defined.