Skip to content

Commit

Permalink
Create main.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
fossyy authored Sep 15, 2024
1 parent 95da902 commit ea6026c
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Docker Build and Push

on:
push:
branches:
- main
- staging

jobs:
build-and-push:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Log in to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Build and push Docker image
uses: docker/build-push-action@v2
with:
context: .
push: true
tags: |
${{ secrets.DOCKERHUB_USERNAME }}/cutit:${{ github.ref_name }}
${{ secrets.DOCKERHUB_USERNAME }}/cutit:latest
if: github.ref == 'refs/heads/main'

- name: Build and push Docker image for staging
uses: docker/build-push-action@v2
with:
context: .
push: true
tags: |
${{ secrets.DOCKERHUB_USERNAME }}/cutit:staging
if: github.ref == 'refs/heads/staging'

0 comments on commit ea6026c

Please sign in to comment.