diff --git a/.env.dev b/.env similarity index 100% rename from .env.dev rename to .env diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index 6f2012f..9bbad84 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -22,14 +22,14 @@ jobs: mkdir ${{ secrets.PATH }} cd ${{ secrets.PATH }} git clone -b prod https://github.com/${{ github.repository }} . - mv .env.dev .env.prod - sed -i "s/ASTRO_URL=.*/ASTRO_URL=${{ vars.ASTRO_URL }}/" .env.prod - sed -i "s/PAYLOAD_URL=.*/PAYLOAD_URL=${{ vars.PAYLOAD_URL }}/" .env.prod - sed -i "s/PAYLOAD_PORT=.*/PAYLOAD_PORT=${{ secrets.PAYLOAD_PORT }}/" .env.prod - sed -i "s/PAYLOAD_SECRET=.*/PAYLOAD_SECRET=${{ secrets.PAYLOAD_SECRET }}/" .env.prod - sed -i "s/MONGODB_URI=.*/MONGODB_URI=${{ secrets.MONGODB_URI }}/" .env.prod - sed -i "s/MONGODB_USER=.*/MONGODB_USER=${{ secrets.MONGODB_USER }}/" .env.prod - sed -i "s/MONGODB_PW=.*/MONGODB_PW=${{ secrets.MONGODB_PW }}/" .env.prod - sed -i "s/NAME=.*/NAME=${{ vars.NAME }}/" .env.prod + cp .env ./astro/.env + sed -i "s/ASTRO_URL=.*/ASTRO_URL=${{ vars.ASTRO_URL }}/" .env + sed -i "s/PAYLOAD_URL=.*/PAYLOAD_URL=${{ vars.PAYLOAD_URL }}/" .env + sed -i "s/PAYLOAD_PORT=.*/PAYLOAD_PORT=${{ secrets.PAYLOAD_PORT }}/" .env + sed -i "s/PAYLOAD_SECRET=.*/PAYLOAD_SECRET=${{ secrets.PAYLOAD_SECRET }}/" .env + sed -i "s/MONGODB_URI=.*/MONGODB_URI=${{ secrets.MONGODB_URI }}/" .env + sed -i "s/MONGODB_USER=.*/MONGODB_USER=${{ secrets.MONGODB_USER }}/" .env + sed -i "s/MONGODB_PW=.*/MONGODB_PW=${{ secrets.MONGODB_PW }}/" .env + sed -i "s/NAME=.*/NAME=${{ vars.NAME }}/" .env fi yarn prod diff --git a/README.md b/README.md index 5f8936d..796cb9c 100644 --- a/README.md +++ b/README.md @@ -25,4 +25,4 @@ Because Astro is completely static, a content change in the CMS must trigger a n 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 and envs in the settings. You can find which secrets and envs are used in the `.github/workflows/push.yml` file. This file converts the existing `.env.dev` to `.env.prod` and adds the secrets and envs that have already been defined. +Please note that since deployment is done through Github Workflows, you need to define the necessary secrets and envs in the settings. You can find which secrets and envs are used in the `.github/workflows/push.yml` file. This file adds the secrets and envs to the `.env` that have already been defined. diff --git a/package.json b/package.json index 2fbe51f..6d14111 100644 --- a/package.json +++ b/package.json @@ -2,9 +2,8 @@ "name": "astrotus", "license": "MIT", "scripts": { - "dev": "docker compose -f docker-compose.yml -f docker-compose-dev.yml --env-file .env.dev up -d", - "prod": "docker compose -f docker-compose.yml -f docker-compose-prod.yml --env-file .env.prod up -d --build", - "stop": "docker compose -f docker-compose.yml -f docker-compose-dev.yml --env-file .env.dev down && docker compose -f docker-compose.yml -f docker-compose-prod.yml --env-file .env.prod down", - "dump": "docker exec -i astrotus_database /bin/sh -c 'PGPASSWORD=password pg_dump --username directus directus' > ./dump.sql" + "dev": "docker compose -f docker-compose.yml -f docker-compose-dev.yml up -d", + "prod": "docker compose -f docker-compose.yml -f docker-compose-prod.yml up -d --build", + "stop": "docker compose -f docker-compose.yml -f docker-compose-dev.yml down && docker compose -f docker-compose.yml -f docker-compose-prod.yml down" } }