.github: package unstable Helm charts, too. #1
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: Package Helm charts | |
on: | |
push: | |
branches: | |
- main | |
- release-* | |
tags: | |
- "v*.*.*" | |
env: | |
CHARTS_DIR: deployment/helm/ | |
jobs: | |
release: | |
permissions: | |
contents: write | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Install Helm | |
uses: azure/setup-helm@v3 | |
- name: Package Helm charts | |
run: | | |
GITREF=${{ github.ref }} | |
case $GITREF in | |
refs/tags/v*) | |
version="v${GITREF#refs/tags/}" | |
;; | |
refs/heads/main) | |
version=unstable | |
;; | |
refs/heads/release-*) | |
version="v${GITREF#refs/heads/release-}-unstable" | |
;; | |
*) | |
echo "error: can't determine Helm chart version." | |
exit 1 | |
;; | |
esac | |
echo "- Packaging Helm charts for version $version..." | |
helm package --version "$version" --app-version "$version" "$CHARTS_DIR"/* | |
find . -name '*.tgz' -print | while read SRC_FILE; do | |
DEST_FILE=$(echo $SRC_FILE | sed 's/v/helm-chart-v/g') | |
mv $SRC_FILE $DEST_FILE | |
echo " - created chart $DEST_FILE..." | |
done | |
- name: Upload Helm packages to GitHub releases | |
uses: softprops/action-gh-release@v1 | |
with: | |
name: ${{ github.ref_name }} | |
draft: true | |
append_body: true | |
files: nri-*helm-chart*.tgz |