Skip to content

Merge pull request #9 from lalithkota/main #6

Merge pull request #9 from lalithkota/main

Merge pull request #9 from lalithkota/main #6

Workflow file for this run

name: Publish OpenG2P Helm charts on
on:
push:
branches:
- 1.*
- develop
- main
jobs:
generate-charts:
runs-on: ubuntu-latest
env:
SKIP: 'FALSE'
defaults:
run:
shell: bash
steps:
- name: Checkout Repository
uses: actions/checkout@v2
- id: files
uses: jitterbit/get-changed-files@v1
- name: save helm/charts to tmp.txt file
run: |
touch tmp.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 >> tmp.txt;
echo "Saved $chart_name chart to tmp.txt"
fi
done
cat tmp.txt | sort | uniq > tmp1.txt
mv tmp1.txt tmp.txt
echo "List of charts to be published";
cat tmp.txt
- name: Generate tar files
run: |
if [[ ! -s ./tmp.txt ]]; then
echo "::warning::No Charts to publish";
echo "SKIP=TRUE" >> $GITHUB_ENV
else
while IFS= read -r line
do
fullpath=$line
echo "Pullpath: $fullpath"
fullname=$(basename "$line")
echo "Filename: $fullname"
helm package charts/$fullpath
done < tmp.txt
rm tmp.txt
fi
- name: Upload tar as Artifact
uses: actions/upload-artifact@v2
with:
name: charts
path: ./*.tgz
if: env.SKIP != 'TRUE'
- name: Checkout branch for publishing
uses: actions/checkout@v2
with:
ref: gh-pages
if: env.SKIP != 'TRUE'
- name: Download tar from Artifacts
uses: actions/download-artifact@v2
with:
name: charts
path: ./
if: env.SKIP != 'TRUE'
- name: Update index.yaml
run: |
git status
helm repo index --url https://openg2p.github.io/openg2p-helm/ .
if: env.SKIP != 'TRUE'
- name: Commit Changes to repository
uses: EndBug/add-and-commit@v7
with:
branch: gh-pages
default_author: github_actions
message: 'added helm charts for release ${{ github.event.inputs.git-ref }}'
add: './*.tgz ./index.yaml'
if: env.SKIP != 'TRUE'