cert-manager-webhook-example/.github/workflows/helm-release.yaml
2025-07-09 15:52:52 +02:00

56 lines
No EOL
1.8 KiB
YAML

# This workflow publishes a new chart release to github pages
# The content of the branch gh-pages is then published to https://puzzle.github.io/cert-manager-webhook-dnsimple/
name: Release a new chart version
on:
workflow_dispatch:
workflow_call:
inputs:
release-body-addendum:
type: string
required: false
jobs:
release:
permissions:
contents: write
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ github.event.repository.default_branch }}
# fetch-tags: true - from experience, this usually results in errors
# > Also see: https://github.com/actions/checkout/issues/1467
- name: Configure Git
run: |
git config user.name "$GITHUB_ACTOR"
git config user.email "$GITHUB_ACTOR@users.noreply.github.com"
- name: Run chart-releaser
uses: helm/chart-releaser-action@v1.7.0
env:
CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
with:
charts_dir: ./charts
- name: Add commit digest to GH release
run: |
git fetch --tags
LAST_TAG=$(git tag --list 'cert-manager-webhook-dnsimple*' --sort=-v:refname | sed -n '2p')
CURRENT_TAG=$(git tag --list 'cert-manager-webhook-dnsimple*' --sort=-v:refname | sed -n '1p')
COMMITS=$(git log ${LAST_TAG}..${CURRENT_TAG} --oneline | sed 's/^/- /')
# Workaround to get newlines working
echo -e "### Changes since \`${LAST_TAG}\`\n\n${COMMITS}" > msg
if [[ -n "${{ inputs.release-body-addendum }}" ]]; then
echo -e "\n${{ inputs.release-body-addendum }}" >> msg
fi
gh release edit ${CURRENT_TAG} --notes "$(cat msg)"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}