Skip to content

Commit

Permalink
⛽ feat(github-actions): add CI for building and pushing Docker image …
Browse files Browse the repository at this point in the history
…to Dockerhub
  • Loading branch information
mostafaghadimi committed Aug 26, 2023
1 parent 5433e78 commit d54827d
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
---
name: CI/CD pipeline for building Docker image

on:
push:
branches:
- main

jobs:
build:
runs-on: ubuntu-latest
if: github.event_name != 'pull_request'
steps:
- uses: actions/checkout@v3
- uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Extract metadata for the Docker image
id: meta
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
with:
images: databurst/git-sync
flavor: latest=true
tags: |
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
- name: Build Docker image
run: docker build -t ${{ steps.meta.outputs.tags }} .
- name: Log in to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Push image to Docker Hub
run: docker push databurst/landing-page:${{ steps.meta.outputs.tags }}

0 comments on commit d54827d

Please sign in to comment.