generating .env in actions added #19
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
name: Docker Image CI | |
on: | |
push: | |
branches: [ "main" ] | |
pull_request: | |
branches: [ "main" ] | |
jobs: | |
build: | |
runs-on: self-hosted | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Generate .env file | |
uses: SpicyPizza/[email protected] | |
with: | |
# 3rd party variables. | |
envkey_POSTGRES_DB: ${{ vars.POSTGRES_DB }} | |
envkey_POSTGRES_USER: ${{ vars.POSTGRES_USER }} | |
envkey_POSTGRES_PASSWORD: ${{ vars.POSTGRES_PASSWORD }} | |
envkey_CERTBOT_EMAIL: ${{ vars.CERTBOT_EMAIL }} | |
envkey_CERTBOT_DOMAIN: ${{ vars.CERTBOT_DOMAIN }} | |
file_name: .env | |
fail_on_empty: true | |
- name: Build the Docker image | |
run: | | |
docker compose build | |
docker compose run --rm web python manage.py makemigrations | |
docker compose run --rm web python manage.py migrate | |
docker compose run --rm web python manage.py collectstatic --no-input | |
test: | |
runs-on: self-hosted | |
needs: | |
- build | |
steps: | |
- name: Run tests | |
run: | | |
docker compose run --rm web python manage.py test | |
deploy: | |
runs-on: self-hosted | |
needs: | |
- build | |
- test | |
steps: | |
- name: Deploy | |
run: | | |
docker compose up -d --force-recreate --remove-orphans | |