Skip to content

Commit

Permalink
Abstract the workflow to base-docker-publish.yml (#552, #553)
Browse files Browse the repository at this point in the history
  • Loading branch information
jongwooo authored and hackerwins committed Jun 18, 2023
1 parent fade761 commit dbc4cf0
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 60 deletions.
41 changes: 41 additions & 0 deletions .github/workflows/base-docker-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Base Docker Publish
on:
workflow_call:
inputs:
command:
description: make command to run
required: true
default: docker # or docker-latest
type: string
jobs:
build:
name: build
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v3

- name: Set up Go 1.19.2
uses: actions/setup-go@v4
with:
go-version: 1.19.2

- name: Use docker buildx
run: docker buildx create --use

- name: Get tools dependencies
run: make tools

- name: Build
run: make build

- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Build Image
env:
COMMAND: ${{ inputs.command }}
run: make $COMMAND
35 changes: 5 additions & 30 deletions .github/workflows/docker-publish-latest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,33 +4,8 @@ on:
branches:
- main
jobs:
build:
name: build
runs-on: ubuntu-latest
steps:

- name: Set up Go 1.19.2
uses: actions/setup-go@v2
with:
go-version: 1.19.2

- name: Check out code
uses: actions/checkout@v2

- name: Use docker buildx
run: docker buildx create --use

- name: Get tools dependencies
run: make tools

- name: Build
run: make build

- name: Login to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Build Image
run: make docker-latest
call-base-docker-publish:
uses: ./.github/workflows/base-docker-publish.yml
secrets: inherit
with:
command: docker-latest
35 changes: 5 additions & 30 deletions .github/workflows/docker-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,33 +3,8 @@ on:
release:
types: [published]
jobs:
build:
name: build
runs-on: ubuntu-latest
steps:

- name: Set up Go 1.19.2
uses: actions/setup-go@v2
with:
go-version: 1.19.2

- name: Check out code
uses: actions/checkout@v2

- name: Use docker buildx
run: docker buildx create --use

- name: Get tools dependencies
run: make tools

- name: Build
run: make build

- name: Login to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Build Image
run: make docker
call-base-docker-publish:
uses: ./.github/workflows/base-docker-publish.yml
secrets: inherit
with:
command: docker

0 comments on commit dbc4cf0

Please sign in to comment.