Skip to content

Commit

Permalink
Updating tagging to be automatic
Browse files Browse the repository at this point in the history
Signed-off-by: Coury Richards <[email protected]>
  • Loading branch information
couryrr-afs committed Feb 21, 2024
1 parent ea4a417 commit 230a3cd
Showing 1 changed file with 31 additions and 27 deletions.
58 changes: 31 additions & 27 deletions .github/workflows/build-kit.yaml
Original file line number Diff line number Diff line change
@@ -1,44 +1,48 @@
name: build-kit docker image

on:
workflow_dispatch:
inputs:
base-system:
type: choice
description: Base system type
default: 'alpine'
required: true
options:
- alpine
- debian
tag:
type: string
description: Image tag
default: 'latest'

push:
branches:
- "**"
tags:
- "v*.*.*"
pull_request:
branches:
- main
jobs:
main:
name: Build and push
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup docker buildx
uses: docker/setup-buildx-action@v2

- name: Login to ghcr.io
uses: docker/login-action@v2
- name: Checkout
uses: actions/checkout@v4
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
# list of Docker images to use as base name for tags
images: |
ghcr.io/${{github.event.repository.owner}}/${{github.event.repository.name}}/build-kit-alpine
# generate Docker tags based on the following events/attributes
tags: |
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=sha
- name: Log in to container registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
username: ${{ github.actor}}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push
uses: docker/build-push-action@v4
uses: docker/build-push-action@v5
with:
context: docker/images/build-kit
file: docker/images/build-kit/${{ inputs.base-system }}.Dockerfile
tags: ghcr.io/everest/build-kit-${{ inputs.base-system }}:${{ inputs.tag }}
file: docker/images/build-kit/alpine.Dockerfile
tags: ${{ steps.meta.outputs.tags }}
push: true
cache-from: type=gha
cache-to: type=gha,mode=max

0 comments on commit 230a3cd

Please sign in to comment.