Skip to content

Commit

Permalink
WiP: unstable Helm charts...
Browse files Browse the repository at this point in the history
Signed-off-by: Krisztian Litkey <[email protected]>
  • Loading branch information
klihub committed Feb 14, 2024
1 parent 3b9fbf9 commit 2e0763b
Showing 1 changed file with 50 additions and 2 deletions.
52 changes: 50 additions & 2 deletions .github/workflows/package-helm.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,17 @@ on:
push:
tags:
- "v*.*.*"
branches:
- main

env:
CHARTS_DIR: deployment/helm/
IS_RELEASE: ${{ github.ref == 'refs/heads/main' && 'false' || 'true' }}
UNSTABLE_CHARTS: unstable-helm-charts

jobs:
release:
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
permissions:
contents: write
runs-on: ubuntu-latest
Expand All @@ -20,7 +25,7 @@ jobs:
- name: Install Helm
uses: azure/[email protected]

- name: Package Helm charts
- name: Package Release Helm Charts
run: |
find "$CHARTS_DIR" -name values.yaml | xargs -I '{}' \
sed -e s"/pullPolicy:.*/pullPolicy: IfNotPresent/" -i '{}'
Expand All @@ -30,10 +35,53 @@ jobs:
mv $SRC_FILE $DEST_FILE
done
- name: Upload Helm packages to GitHub releases
- name: Upload Release Helm Chart Packages to GitHub Release
uses: softprops/action-gh-release@v1
with:
name: ${{ github.ref_name }}
draft: true
append_body: true
files: nri-*helm-chart*.tgz

unstable:
if: ${{ github.ref == 'refs/heads/main' }}
permissions:
contents: write
runs-on: ubuntu-latest
steps:
- name: Deep Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Install Helm
uses: azure/[email protected]

- name: Package Unstable Helm Charts
run: |
majminpatch="$(git describe | sed -E 's/(v[0-9]*\.[0-9]*\.[0-9]*).*$/\1/')"
majmin=${majminpatch%.*}
patch=${majminpatch##*.}
CHART_VERSION="${majmin}.$((patch+1))-unstable"
APP_VERSION=unstable
find "$CHARTS_DIR" -name values.yaml | xargs -I '{}' \
sed -e s"/pullPolicy:.*/pullPolicy: IfNotPresent/" -i '{}'
helm package --version "$CHART_VERSION" --app-version $APP_VERSION "$CHARTS_DIR"/*
git worktree add --orphan ../$UNSTABLE_CHARTS
find . -name '*.tgz' -print | while read SRC_FILE; do
DEST_FILE=$(echo $SRC_FILE | sed 's/v/helm-chart-v/g')
mv -v $SRC_FILE ../$UNSTABLE_CHARTS/$DEST_FILE
done
pushd ../$UNSTABLE_CHARTS
git config user.name "Github Actions"
git config user.email "[email protected]"
git add *helm-chart*.tgz
git commit -s -m "$UNSTABLE_CHARTS: package $CHART_VERSION."
- name: Publish/Push Unstable Helm Charts
shell: bash
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git push https://${GITHUB_ACTOR}:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git :$UNSTABLE_CHARTS || :
git push https://${GITHUB_ACTOR}:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git :refs/heads/$UNSTABLE_CHARTS

0 comments on commit 2e0763b

Please sign in to comment.