Skip to content

Cookie cleanup (#90) #64

Cookie cleanup (#90)

Cookie cleanup (#90) #64

name: Docker Build and Deployment
on:
push:
branches:
- dev
jobs:
build_and_push_docker_image:
name: Build and Push Docker Image
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Log Workflow Start
run: echo "Starting Docker Build and Deployment workflow..."
- name: Checkout Code
uses: actions/checkout@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Log in to GitHub Container Registry (GHCR)
id: login # This ID is used in the conditional checks later
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and Push Docker Image
if: steps.login.outcome == 'success'
uses: docker/build-push-action@v3
with:
context: .
push: true
tags: |
ghcr.io/imperfectandcompany/imperfect-gamers-site:latest
ghcr.io/imperfectandcompany/imperfect-gamers-site:${{ github.sha }}
- name: Logout from GHCR
if: steps.login.outcome == 'success'
run: docker logout ghcr.io
- name: Log Workflow End
if: always()
run: echo "Docker Build and Deployment workflow completed."
- name: Fail Workflow on Login Failure
if: steps.login.outcome != 'success'
run: echo "Failed to login to GitHub Container Registry" && exit 1