Skip to content

Merge pull request #698 from spinframework/dependabot/github_actions/… #487

Merge pull request #698 from spinframework/dependabot/github_actions/…

Merge pull request #698 from spinframework/dependabot/github_actions/… #487

# This action releases the runtime-class-manager helm chart
#
# A chart is published to the configured OCI registry on every push to main
# as well as on semver tag releases (via workflow_call from release.yml).
name: Release helm chart
on:
push:
branches:
- main
workflow_call:
permissions:
contents: read
env:
REGISTRY: ghcr.io
CHART_NAME: runtime-class-manager
jobs:
release:
name: Release chart
runs-on: ubuntu-22.04
permissions:
packages: write
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
fetch-depth: 0
- name: Install helm
uses: Azure/setup-helm@dda3372f752e03dde6b3237bc9431cdc2f7a02a2 # v5.0.0
with:
version: v3.16.3
- name: Determine chart version
run: |
if [[ "${{ startsWith(github.ref, 'refs/tags/v') }}" == "true" ]]; then
# NOTE: We remove the leading 'v' to comply with helm's versioning requirements
echo "CHART_VERSION=$(echo -n ${{ github.ref_name }} | sed -rn 's/(v)?(.*)/\2/p')" >> $GITHUB_ENV
echo "APP_VERSION=${{ github.ref_name }}" >> $GITHUB_ENV
else
echo "CHART_VERSION=$(git describe --tags $(git rev-list --tags --max-count=1))-$(date +%Y%m%d-%H%M%S)-g$(git rev-parse --short HEAD)" >> $GITHUB_ENV
# Setting to 'latest' to match tag used in container-image.yml
echo "APP_VERSION=latest" >> $GITHUB_ENV
fi
- name: Log into registry ${{ env.REGISTRY }}
uses: docker/login-action@650006c6eb7dba73a995cc03b0b2d7f5ca915bee # v4.2.0
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Package chart
run: make helm-package
- name: Lint packaged chart
run: make helm-lint
- name: Upload chart as GitHub artifact
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: ${{ env.CHART_NAME }}
path: _dist/${{ env.CHART_NAME }}-${{ env.CHART_VERSION }}.tgz
- name: Publish chart
env:
CHART_REGISTRY: ${{ env.REGISTRY }}/${{ github.repository_owner }}/charts
run: |
make helm-publish
echo '### Helm chart published:' >> $GITHUB_STEP_SUMMARY
echo '- `Reference: ${{ env.CHART_REGISTRY }}/${{ env.CHART_NAME }}`' >> $GITHUB_STEP_SUMMARY
echo '- `Version: ${{ env.CHART_VERSION }}`' >> $GITHUB_STEP_SUMMARY