diff --git a/.github/workflows/build-docker.yml b/.github/workflows/build-docker.yml new file mode 100644 index 0000000..c037691 --- /dev/null +++ b/.github/workflows/build-docker.yml @@ -0,0 +1,45 @@ +name: Build and Push Docker Image + +on: + workflow_run: + workflows: + - Merge to Main Branch + types: + - completed + +jobs: + build-and-push-docker-image: + runs-on: ubuntu-latest + steps: + - name: Setting Up QEMU + uses: docker/setup-qemu-action@v2 + + - name: Setting Up Docker Buildx + uses: docker/setup-buildx-action@v2 + + - name: Login to Docker Hub + uses: docker/login-action@v2 + with: + username: ${{ github.repository_owner }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Checkout + uses: actions/checkout@v3 + with: + fetch-depth: 0 # Required for github-action-get-previous-tag + + - name: Get Latest Tag + id: get-tag + uses: WyriHaximus/github-action-get-previous-tag@v1 + with: + fallback: v1.0.0 + + - name: Building and Pushing + uses: docker/build-push-action@v3 + if: steps.get-tag.outputs.tag + with: + push: true + file: ./ci/Dockerfile + tags: | + ${{ github.repository }}:${{ steps.get-tag.outputs.tag }} + ${{ github.repository }}:latest