Skip to content

Commit

Permalink
Build and push docker image when merged
Browse files Browse the repository at this point in the history
  • Loading branch information
seungkyua committed Sep 8, 2021
1 parent 4249f0e commit 7508d85
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 9 deletions.
27 changes: 27 additions & 0 deletions .github/workflows/deploy-image-with-branch.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Create and publish a package
on:
pull_request:
branches:
- main
jobs:
build-and-pPush-image:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Build and push
id: docker_build
uses: docker/build-push-action@v2
with:
push: true
tags: seungkyua/tks-info:${{ github.head_ref }}
25 changes: 16 additions & 9 deletions .github/workflows/deploy-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,26 @@ on:
push:
branches:
- main
release:
types: [published]

jobs:
build-and-push-image:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Build container image
uses: docker/build-push-action@v1

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
registry: docker.pkg.github.com
repository: ${{ github.repository }}/tks-info
tag_with_ref: true
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Build and push
id: docker_build
uses: docker/build-push-action@v2
with:
push: true
tags: seungkyua/tks-info:latest

0 comments on commit 7508d85

Please sign in to comment.