Create main.yml

This commit is contained in:
2024-09-08 17:38:03 +07:00
committed by GitHub
parent 445b56fee4
commit 3b58270e51

40
.github/workflows/main.yml vendored Normal file
View File

@ -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 }}/filekeeper:${{ github.ref_name }}
${{ secrets.DOCKERHUB_USERNAME }}/filekeeper: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 }}/filekeeper:staging
if: github.ref == 'refs/heads/staging'