Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions .github/workflows/build-and-push.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
---
name: Build and Push Docker Container

on:
workflow_dispatch:
pull_request:
branches: [ $default_branch ]
push:

env:
github_runner: ubuntu-latest
container_name: gh-cli
docker_file: ubuntu20.Dockerfile
docker_tags: ghcr.io/gunnarwustl/gh-cli:ubuntu20

jobs:
diff_check:
runs-on: ubuntu-latest
steps:
- name: Diff Check
uses: ./.github/workflows/steps/diff-check.yaml
with:
container_name: ${{ env.container_name }}
docker_file: ${{ env.docker_file }}

build_push:
runs-on: ubuntu-latest
steps:
- name: Build and Push
uses: ./.github/workflows/steps/docker-build.yaml
with:
push_image_bool: true
19 changes: 19 additions & 0 deletions .github/workflows/steps/diff-check.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
name: Diff Check

jobs:
diff_check:
runs-on: ubuntu-latest
outputs:
${{ container_name }}: ${{ steps.filter.outputs.${{ container_name }} }}
steps:
- name: Checkout Code
uses: actions/checkout@v3

- name: Examine Paths and Files
uses: dorny/paths-filter@v2
id: filter
with:
filters: |
${{ container_name }}:
- ${{ docker_file }}
26 changes: 26 additions & 0 deletions .github/workflows/steps/docker-build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
---
name: Build ${{ container_name }}

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v3

- name: Container Repository Login
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Setup BuildKit
uses: docker/setup-buildx-action@v2

- name: Build and Push Container
uses: docker/build-push-action@v3
with:
file: ${{ docker_file }}
tags: ${{ docker_tags }}
push: ${{ push_image_bool }}