Append: Fix formatting in publish action #2
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 release chart (tags) | |
on: | |
push: | |
tags: | |
# Semantic versioning; must be equal to version in Chart.yaml | |
- "v[0-9]+.[0-9]+.[0-9]+" | |
jobs: | |
publish: | |
name: Publish Helm chart | |
if: github.repository == 'logicalclocks/rondb-helm' | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
steps: | |
- name: Checkout main repo | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- run: | | |
echo "GH ref: ${{ github.ref }}" | |
echo "GH ref_name: ${{ github.ref_name }}" | |
- name: Only allow main branch to publish | |
run: | | |
branch=$(git branch -r --contains ${{ github.ref }} --format "%(refname:lstrip=3)") | |
echo "Current branch: $branch" | |
# Exit if branch is not main | |
if [ "$branch" != "main" ]; then | |
echo "::error Branch is not main, exiting" | |
exit 1 | |
fi | |
- name: Check that Git tag matches Chart.yaml version | |
run: | | |
TAG=$(echo ${{ github.ref_name }} | sed 's/v//') | |
CHART_VERSION=$(grep '^version:' Chart.yaml | awk '{print $2}') | |
if [ "$TAG" != "$CHART_VERSION" ]; then | |
echo "::error Tag $TAG does not match Chart.yaml version $CHART_VERSION" | |
exit 1 | |
fi | |
echo "CHART_VERSION=$CHART_VERSION" >> $GITHUB_ENV | |
- name: Publish Helm chart | |
uses: ./.github/actions/publish_chart | |
with: | |
chart_version: "${{ env.CHART_VERSION }}" | |
# Since Git tags are unique, overwriting shouldn't happen anyways | |
allow_overwrite: "false" | |
gh_token: ${{ secrets.GITHUB_TOKEN }} |