Skip to content

3.12.3-1

3.12.3-1 #79

Workflow file for this run

name: Publish Docker image
on:
release:
branch: main
types: [published]
jobs:
push_to_registry:
name: Push Docker image to GitHub Packages
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Prepare
id: prep
run: |
GHCR_IMAGE=ghcr.io/${{ github.repository_owner }}/helm
VERSION=latest
TAGS="${GHCR_IMAGE}:${VERSION}"
if [[ $GITHUB_REF == refs/tags/* ]]; then
VERSION=${GITHUB_REF#refs/tags/}
TAGS="${TAGS},${GHCR_IMAGE}:${VERSION}"
fi
echo "VERSION=${VERSION}" >> $GITHUB_ENV
echo "GHCR_IMAGE=${GHCR_IMAGE}" >> $GITHUB_ENV
echo "TAGS=${TAGS}" >> $GITHUB_ENV
echo "IMAGE=ghcr.io/$GITHUB_REPOSITORY" >> $GITHUB_ENV
echo "BUILD_DATE=$(date +'%Y-%m-%d %H:%M:%S')" >> $GITHUB_ENV
echo "GIT_SHA=$(echo ${{ github.sha }} | cut -c1-7)" >> $GITHUB_ENV
echo "GIT_REF=$(git symbolic-ref -q --short HEAD || git describe --tags --exact-match)" >> $GITHUB_ENV
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.CR_PAT }}
- name: Build and push
id: docker_build
uses: docker/build-push-action@v4
with:
push: true
labels: |
org.opencontainers.image.authors=${{ github.repository_owner }}
org.opencontainers.image.created=${{ env.BUILD_DATE }}
org.opencontainers.image.description=Created from commit ${{ env.GIT_SHA }} and ref ${{ env.GIT_REF }}
org.opencontainers.image.ref.name=${{ env.GIT_REF }}
org.opencontainers.image.revision=${{ github.sha }}
org.opencontainers.image.source=https://github.com/${{ github.repository }}
tags: ${{ env.TAGS }}
- name: Check manifest
run: docker buildx imagetools inspect ${{ env.GHCR_IMAGE }}:${{ env.VERSION }}