3.16.2-1 #96
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Publish Docker image | |
on: | |
release: | |
branch: main | |
types: [published] | |
jobs: | |
push_to_registry: | |
name: Push Docker image to GitHub Packages | |
runs-on: ubuntu-latest | |
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/} | |
MAJOR_VERSION=$(echo $VERSION | cut -d '.' -f 1 | tr -d 'v') | |
TAGS="${TAGS},${GHCR_IMAGE}:${VERSION},${GHCR_IMAGE}:${MAJOR_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 }} |