Bumped tag to 0.1.2 #1
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: Release Charts | |
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 "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 "Tag $TAG does not match Chart.yaml version $CHART_VERSION" | |
exit 1 | |
fi | |
- name: Set up Helm | |
uses: azure/setup-helm@v4 | |
with: | |
version: '3.13.3' | |
env: | |
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" | |
- name: Configure Git | |
run: | | |
git config user.name "$GITHUB_ACTOR" | |
git config user.email "[email protected]" | |
- name: Package Helm Charts | |
run: helm package . --destination ./charts/ | |
# This will fail if the Helm package already exists; But Git tags can't | |
# be duplicated anyways and a release shouldn't be overwritten either. | |
- name: Checkout gh-pages branch | |
run: | | |
git fetch origin gh-pages | |
git checkout gh-pages | |
- name: Generate index.yaml corresponding to the existing charts | |
run: helm repo index . --url https://logicalclocks.github.io/rondb-helm/ | |
- name: Commit and Push to gh-pages | |
run: | | |
git add ./charts/* | |
git add index.yaml | |
git commit -m "Release RonDB Helm chart ${{ github.ref_name }}" | |
git push origin gh-pages | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |