Skip to content

Commit

Permalink
Build and push docker image when pr or merged
Browse files Browse the repository at this point in the history
  • Loading branch information
seungkyua committed Sep 2, 2021
1 parent 9fdd8d5 commit ac22292
Show file tree
Hide file tree
Showing 2 changed files with 46 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-push-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-contract:${{ github.head_ref }}
28 changes: 19 additions & 9 deletions .github/workflows/deploy-image.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,28 @@
name: Create and publish a package
on:
release:
types: [published]
push:
branches:
- main

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-contract
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-contract:latest

0 comments on commit ac22292

Please sign in to comment.