Skip to content

Commit

Permalink
Merge pull request #72 from lalithkota/main
Browse files Browse the repository at this point in the history
Github Action Publish Helm charts: upgraded
  • Loading branch information
lalithkota authored Sep 18, 2024
2 parents 436409c + b782638 commit 2f65408
Showing 1 changed file with 27 additions and 11 deletions.
38 changes: 27 additions & 11 deletions .github/workflows/push_trigger.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,20 @@ on:
- 1.*
- develop
- main
workflow_dispatch:
inputs:
forcePublishCharts:
description: "Force publish Charts?"
default: "*"
type: string

jobs:
generate-charts:
runs-on: ubuntu-latest
env:
SKIP: 'FALSE'
RANCHER_CHART_FILTER: "openg2p.org/add-to-rancher"
FORCE_PUBLISH_CHARTS: "${{ inputs.forcePublishCharts || '' }}"
defaults:
run:
shell: bash
Expand All @@ -23,20 +30,29 @@ jobs:
uses: actions/checkout@v3

- id: files
if: env.FORCE_PUBLISH_CHARTS == ''
uses: jitterbit/get-changed-files@v1

- name: save helm/charts to tmp.txt file
run: |
touch charts-list.txt
for changed_file in ${{ steps.files.outputs.all }}; do
if [[ ${changed_file} =~ ^charts ]]; then
chart_name=$(echo "${changed_file}" | awk -F/ '/^[charts]/{print $2}')
echo $chart_name >> charts-list.txt;
echo "Saved $chart_name chart to charts-list.txt"
fi
done
cat charts-list.txt | sort | uniq > charts-list-unique.txt
mv charts-list-unique.txt charts-list.txt
if [ -n "${FORCE_PUBLISH_CHARTS}" ]; then
for chart in charts/${FORCE_PUBLISH_CHARTS}/; do
chart="${chart#charts/}"
chart="${chart%/}"
echo "$chart" >> charts-list.txt
done
else
for changed_file in ${{ steps.files.outputs.all }}; do
if [[ ${changed_file} =~ ^charts ]]; then
chart_name=$(echo "${changed_file}" | awk -F/ '/^[charts]/{print $2}')
echo $chart_name >> charts-list.txt;
echo "Saved $chart_name chart to charts-list.txt"
fi
done
cat charts-list.txt | sort | uniq > charts-list-unique.txt
mv charts-list-unique.txt charts-list.txt
fi
echo "List of charts to be published";
cat charts-list.txt
Expand Down Expand Up @@ -73,7 +89,7 @@ jobs:
echo "SKIP=TRUE" >> $GITHUB_ENV
fi
- name: Upload tar as Artifact
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
with:
name: charts
path: ./*.tgz
Expand All @@ -88,7 +104,7 @@ jobs:
if: env.SKIP != 'TRUE'

- name: Download tar from Artifacts
uses: actions/download-artifact@v2
uses: actions/download-artifact@v4
with:
name: charts
path: ./
Expand Down

0 comments on commit 2f65408

Please sign in to comment.