Skip to content

Remove typo

Remove typo #7

name: Build and Push Docker Image
on:
push:
tags:
- 'v*'
jobs:
build-and-push:
name: Build and Push Docker Image
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Validate Tag Format
id: validate_tag
run: |
if [[ ! "${GITHUB_REF_NAME}" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "Invalid tag format: ${GITHUB_REF_NAME}"
exit 1
fi
env:
GITHUB_REF_NAME: ${{ github.ref_name }}
- name: Create .env File
run: |
echo "Creating .env file"
echo "PLATFORM=${{ vars.PLATFORM }}" >> .env
echo "DEBUG=${{ vars.DEBUG }}" >> .env
echo "ALLOWED_HOSTS=${{ secrets.ALLOWED_HOSTS }}" >> .env
echo "SECRET_KEY=${{ secrets.SECRET_KEY }}" >> .env
echo "AWS_ACCESS_KEY_ID=${{ secrets.AWS_ACCESS_KEY_ID }}" >> .env
echo "AWS_SECRET_ACCESS_KEY=${{ secrets.AWS_SECRET_ACCESS_KEY }}" >> .env
echo "DJANGO_SETTINGS_MODULE=${{ vars.DJANGO_SETTINGS_MODULE }}" >> .env
echo "DATABASE_URL=${{ secrets.DATABASE_URL }}" >> .env
echo "POSTGRES_USER=${{ secrets.POSTGRES_USER }}" >> .env
echo "POSTGRES_PASSWORD=${{ secrets.POSTGRES_PASSWORD }}" >> .env
echo "POSTGRES_DB=${{ secrets.POSTGRES_DB }}" >> .env
shell: bash
- name: Log in to GitHub Container Registry
uses: docker/#-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build Docker Image with docker compose
run: |
docker compose --env-file .env \
-f docker/compose.ci.yaml \
build --build-arg PLATFORM=prod
shell: bash
- name: Push Docker Image to Registry
run: |
IMAGE_NAME="ghcr.io/modernism-in-architecture/mia-django"
docker tag mia-django ${IMAGE_NAME}:${{ github.ref_name }}
docker tag mia-django ${IMAGE_NAME}:latest
docker push ${IMAGE_NAME}:${{ github.ref_name }}
docker push ${IMAGE_NAME}:latest
shell: bash