Skip to content

Commit

Permalink
feat: create CD pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
dhruv-ahuja committed Feb 18, 2024
1 parent 6ee60bc commit 43124cf
Showing 1 changed file with 50 additions and 0 deletions.
50 changes: 50 additions & 0 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: CD

on:
push:
tags: "v*"
branches: main

# allow manually triggering this workflow
workflow_dispatch: {}

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/')
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}}

0 comments on commit 43124cf

Please sign in to comment.