Merge pull request #93 from trifork/fix/remove-deprecated-chart #46
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 to GHCR | |
on: | |
push: | |
branches: | |
- main | |
workflow_dispatch: {} | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
release-helm-chart: | |
name: Release Helm Chart | |
runs-on: ubuntu-latest | |
timeout-minutes: 10 | |
steps: | |
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3 | |
with: | |
fetch-depth: 2 | |
- name: Login to container registry | |
run: | | |
echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin | |
- name: Pushing Helm Chart | |
run: | | |
prev_rev=$(git rev-parse HEAD^) | |
echo "Identifying changed charts since git rev ${prev_rev}" | |
changed_charts=() | |
readarray -t changed_charts <<< "$(git diff --find-renames --diff-filter=d --name-only "$prev_rev" -- charts | cut -d '/' -f 2 | uniq)" | |
if [[ -n "${changed_charts[*]}" ]]; then | |
for chart in "${changed_charts[@]}"; do | |
#echo "Updating dependencies for '$chart'..." | |
helm dependency update "charts/$chart" | |
# create chart package for chart `CHART` | |
helm package charts/$chart | |
# get packed chart file name | |
PKG_NAME=`ls $chart-*.tgz` | |
# push chart to registry | |
helm push ${PKG_NAME} oci://ghcr.io/${GITHUB_REPOSITORY} | |
# remove chart package | |
rm ${PKG_NAME} | |
done | |
else | |
echo "No chart changes detected" | |
fi |