Skip to content

Updated the tags

Updated the tags #23

name: Build and Publish (Develop)
on:
push:
branches:
- develop
jobs:
build-and-publish:
name: Build and Publish to DockerHub and GHCR (Develop)
runs-on: ubuntu-latest
steps:
# Checkout the code
- name: Checkout code
uses: actions/checkout@v4
# Log in to Docker Hub
- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
# Log in to GitHub Container Registry (GHCR)
- name: Log in to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
# Extract metadata (tags, labels) for Docker images
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: |
${{ vars.DOCKER_ORG }}/${{ github.event.repository.name }} # For DockerHub
ghcr.io/${{ github.repository }} # For GHCR
tags: |
type=raw,value=develop,enable=${{ github.ref == 'refs/heads/develop' }}
type=raw,value=latest,enable=${{ github.ref == 'refs/heads/develop' }}
# Build and push Docker image to Docker Hub
- name: Build and push Docker image to Docker Hub
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: |
${{ vars.DOCKER_ORG }}/${{ github.event.repository.name }}:latest
# Build and push Docker image to GHCR
- name: Build and push Docker image to GHCR
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: |
ghcr.io/${{ github.repository }}:develop