Skip to content

CD

CD #7

Workflow file for this run

name: CD
on:
push:
tags: "v*"
# allow manually triggering this workflow
workflow_dispatch:
inputs:
tag:
description: Tag required for deployment
required: true
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
deploy:
# run only if a tag is available
if: startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Log into Docker Hub
uses: docker/login-action@v3
with:
username: ${{secrets.DOCKER_USERNAME}}
password: ${{secrets.DOCKER_PASSWORD}}
- name: Extract metadata for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: dhruvahuja/backend_burger
tags:
# use git tag pattern
type=semver,pattern={{version}}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build and push docker image
uses: docker/build-push-action@v5
with:
context: .
file: ./Dockerfile
push: true
tags: ${{steps.meta.outputs.tags}}
labels: ${{steps.meta.outputs.labels}}