Skip to content

build and push docs also on tag push (#542) #194

build and push docs also on tag push (#542)

build and push docs also on tag push (#542) #194

Workflow file for this run

name: Image
on:
push:
tags:
- 'v*'
branches:
- main
permissions:
contents: read
packages: write
id-token: write
jobs:
image:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: v1.26.2
check-latest: true
# We need this to remove local tags that are not semver so goreleaser doesn't get confused.
- name: Delete non-semver tags
run: 'git tag -d $(git tag -l | grep -v "^v")'
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
# If you notice signing errors, you may need to update the cosign version.
- uses: sigstore/cosign-installer@v3.7.0
- name: Install Helm
uses: azure/setup-helm@v3
with:
version: 'v3.12.0'
- name: Compute build env
run: |
{
echo "LDFLAGS=$(make ldflags)"
echo "IMAGE_REPO=ghcr.io/${{ github.repository_owner }}"
echo "IMAGE_TAGS=latest ${{ github.sha }} 0.0.0-${{ github.sha }} ${{ github.ref_name }}"
echo "BUILDX_CACHE_FROM=type=gha"
echo "BUILDX_CACHE_TO=type=gha,mode=max"
echo "COSIGN_ARGS=-a sha=${{ github.sha }} -a ref=${{ github.ref }} -a run_id=${{ github.run_id }} -a run_attempt=${{ github.run_attempt }}"
} >> "$GITHUB_ENV"
# Common OCI labels (one per line so build-image.sh can split on newlines)
{
echo 'IMAGE_LABELS<<EOF'
echo "org.opencontainers.image.source=https://github.com/${{ github.repository }}"
echo "org.opencontainers.image.revision=${{ github.sha }}"
echo "org.opencontainers.image.version=${{ github.ref_name }}"
echo 'EOF'
} >> "$GITHUB_ENV"
# Helm chart version: semver from tag, otherwise 0.0.0-<sha>
if [[ "${{ github.ref_type }}" == "tag" ]]; then
chart_version="${{ github.ref_name }}"
echo "CHART_VERSION=${chart_version#v}" >> "$GITHUB_ENV"
else
echo "CHART_VERSION=0.0.0-${{ github.sha }}" >> "$GITHUB_ENV"
fi
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Login to GHCR for Helm
env:
HELM_EXPERIMENTAL_OCI: '1'
run: echo "${{ github.token }}" | helm registry login ghcr.io --username ${{ github.actor }} --password-stdin
- name: Build, push, and sign images
run: make release-images
- name: Build and push Helm charts
run: make release-helm
- uses: actions/delete-package-versions@v3
with:
package-name: '${{ github.event.repository.name }}'
min-versions-to-keep: 10
delete-only-pre-release-versions: "true"