Skip to content

fix: adapt chart-releaser workflow (#3) #11

fix: adapt chart-releaser workflow (#3)

fix: adapt chart-releaser workflow (#3) #11

Workflow file for this run

name: 'Build and push main/tags'
on:
workflow_dispatch:
push:
branches:
- 'main'
tags:
- 'v*'
# Ignore specific changes
paths-ignore:
- 'deploy/**'
pull_request:
types: [ labeled ]
branches:
- 'main'
paths-ignore:
- 'deploy/**'
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository_owner }}/cert-manager-webhook-oci
jobs:
build-and-publish:
if: github.event_name == 'push' || github.event.label.name == 'build'
# depending on default permission settings for your org (contents being read-only or read-write for workloads), you will have to add permissions
# see: https://docs.github.com/en/actions/security-guides/automatic-token-authentication#modifying-the-permissions-for-the-github_token
permissions:
contents: read
packages: write
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
platform:
- linux/amd64
- linux/arm64
steps:
- name: Checkout
uses: actions/checkout@v3
# Add support for more platforms with QEMU (optional)
# https://github.com/docker/setup-qemu-action
- name: Set up QEMU
id: qemu
uses: docker/setup-qemu-action@v2
# https://github.com/docker/setup-buildx-action
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v2
- name: Login to GHCR
if: github.event_name == 'push'
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
# https://github.com/docker/metadata-action
- name: Docker meta
id: meta
uses: docker/metadata-action@v4
with:
images: |
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=ref,event=tag
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
# set latest tag for main branch
type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', 'main') }}
- name: Release build
id: release_build
uses: docker/build-push-action@v4
with:
context: .
platforms: ${{ matrix.platform }}
push: ${{ github.event_name == 'push' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
build-args: |
Version=${{ steps.meta.outputs.tags }}
GitCommit=${{ github.sha }}
- name: Image digest
run: echo ${{ steps.release_build.outputs.digest }}