Skip to content

Commit

Permalink
Add Github workflow to build the image
Browse files Browse the repository at this point in the history
  • Loading branch information
killerwhile committed Nov 23, 2022
1 parent 274645b commit 6df37ea
Show file tree
Hide file tree
Showing 2 changed files with 65 additions and 0 deletions.
59 changes: 59 additions & 0 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: Build and publish OCI image

on:
push:
# Publish semver tags as releases.
tags: [ 'v*.*.*' ]

env:
REGISTRY: ghcr.io
# github.repository as <account>/<repo>
IMAGE_NAME: ${{ github.repository }}

jobs:
build:
name: Build and push OCI image to docker.io registry
runs-on: ubuntu-22.04
steps:
- name: Check out the repo
uses: actions/checkout@v2
with:
fetch-depth: 0
ref: ${{ github.event.workflow_run.head_branch }}

- name: Get tag
id: tag
uses: dawidd6/action-get-tag@v1

- uses: docker/setup-qemu-action@v2
- uses: docker/setup-buildx-action@v2

# Login against a Docker registry except on PR
# https://github.com/docker/login-action
- name: Log into registry ${{ env.REGISTRY }}
if: github.event_name != 'pull_request'
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

# Extract metadata (tags, labels) for Docker
# https://github.com/docker/metadata-action
- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@v4
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}

# Build and push Docker image with Buildx (don't push on PR)
# https://github.com/docker/build-push-action
- name: Build and push Docker image
uses: docker/build-push-action@v3
with:
context: .
build-args: "RELEASE=${{ steps.tag.outputs.tag }}"
platforms: linux/amd64,linux/arm64
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
k8s-mutate-image-and-policy
====

# Version v3.3.1 -- 23.11.2021

## Other

- Build image via Github workflow

# Version v3.3.0 -- 16.09.2021

## Enhancement
Expand Down

0 comments on commit 6df37ea

Please sign in to comment.