Skip to content

Merge pull request #3 from ItsRaelx/main #1

Merge pull request #3 from ItsRaelx/main

Merge pull request #3 from ItsRaelx/main #1

Workflow file for this run

name: Docker Image CI
on:
push:
branches: [main]
jobs:
build-and-publish:
runs-on: ubuntu-latest
permissions:
contents: write
packages: write
env:
IMAGE_NAME: ${{ github.repository }}
steps:
- name: Check out the repository
uses: actions/checkout@v3
- name: Convert IMAGE_NAME to lowercase
run: |
echo "IMAGE_NAME=${IMAGE_NAME,,}" >> $GITHUB_ENV
- name: Build the Docker image
run: |
docker build . --file Dockerfile --tag $IMAGE_NAME:${{ github.sha }}
- name: Log in to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Tag the image with the 'latest' tag
run: |
docker tag $IMAGE_NAME:${{ github.sha }} ghcr.io/$IMAGE_NAME:latest
- name: Tag the image with the SHA
run: |
docker tag $IMAGE_NAME:${{ github.sha }} ghcr.io/$IMAGE_NAME:${{ github.sha }}
- name: Push the Docker image to GitHub Container Registry
run: |
docker push ghcr.io/$IMAGE_NAME:latest
docker push ghcr.io/$IMAGE_NAME:${{ github.sha }}