Skip to content

Commit

Permalink
ci: added build docker workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
kenso312 committed Nov 13, 2022
1 parent f3a77e9 commit 2f478b6
Showing 1 changed file with 45 additions and 0 deletions.
45 changes: 45 additions & 0 deletions .github/workflows/build-docker.yml
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 2f478b6

Please sign in to comment.