Skip to content

Merge pull request #10 from pramod-technoforte/1.2.0.1-GB3 #15

Merge pull request #10 from pramod-technoforte/1.2.0.1-GB3

Merge pull request #10 from pramod-technoforte/1.2.0.1-GB3 #15

Workflow file for this run

name: Publish mosip-helm charts
on:
push:
branches:
- 1.2.0.*
- develop
- govstack*
jobs:
Generate_Documentation:
runs-on: ubuntu-latest
steps:
- name: Set up JDK 11
uses: actions/setup-java@v1
with:
java-version: 11
- name: Checkout Repository
uses: actions/checkout@v2
#if: github.event.inputs.git-ref != ''
#with:
# ref: ${{ github.event.inputs.git-ref }}
- name: Setup Branch and Env
run: |
# Strip git ref prefix from version
echo "BRANCH_NAME=$(echo ${{ github.ref }} | sed -e 's,.*/\(.*\),\1,')" >> $GITHUB_ENV
echo "COMMIT_ID=${GITHUB_SHA}" >> $GITHUB_ENV
- 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
echo "File: ${changed_file}."
if [[ $changed_file =~ ^[charts] ]]; then
echo "${changed_file}" | awk -F '/' '/^[charts]/{print $2}' >> ./tmp.txt;
echo "Saved $( echo ${changed_file} | awk -F '/' '/^[charts]/{print $2}') 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: |
echo "BRANCH_NAME=$BRANCH_NAME";
helm repo add mosip https://tf-govstack.github.io/mosip-helm
echo "COMMIT=${{ env.COMMIT_ID }}"
echo "SKIP=FALSE" >> $GITHUB_ENV
if [[ ! -s ./tmp.txt ]]; then
echo "No Charts to publish";
echo "SKIP=TRUE" >> $GITHUB_ENV
fi
#cd charts &&
#find * -prune -type d > ../tmp.txt
#cd ..
while IFS= read -r line
do
fullpath=$line
echo "Pullpath: $fullpath"
fullname=$(basename "$line")
echo "Filename: $fullname"
helm dependency update charts/$fullpath/
helm package charts/$fullpath
done < tmp.txt
- name: Upload tar as Artifact
uses: actions/upload-artifact@v2
with:
name: charts
path: ./*.tgz
retention-days: 1
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://tf-govstack.github.io/mosip-helm/ .
if: env.SKIP != 'TRUE'
- name: Commit Changes to mosip-helm 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'