-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6ee60bc
commit 0f29685
Showing
1 changed file
with
49 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
name: CD | ||
|
||
on: | ||
# run on new tag push | ||
push: | ||
tags: "v*" | ||
branches: main | ||
|
||
# allow manually triggering this workflow | ||
workflow_dispatch: {} | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
deploy: | ||
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}} |