Skip to content

Publish Specific Charts #1

Publish Specific Charts

Publish Specific Charts #1

name: Publish Specific Charts
on:
workflow_dispatch:
inputs:
charts:
description: 'Charts to publish'
required: true
jobs:
Publish_Specific_Charts:
#needs: Generate_Documentation
runs-on: ubuntu-latest
env:
CHARTS_TO_PUBLISH: ${{ github.event.inputs.charts }}
steps:
- name: Set up JDK 11
uses: actions/setup-java@v1
with:
java-version: 11
- name: Checkout Repository
uses: actions/checkout@v2
- name: Setup Branch and Env
run: |
echo "BRANCH_NAME=$(echo ${{ github.ref }} | sed -e 's,.*/\(.*\),\1,')" >> $GITHUB_ENV
echo "COMMIT_ID=${GITHUB_SHA}" >> $GITHUB_ENV
- name: Generate tar files
run: |
echo "BRANCH_NAME=$BRANCH_NAME"
echo "COMMIT=${{ env.COMMIT_ID }}"
echo "SKIP=FALSE" >> $GITHUB_ENV
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 < <(echo "${CHARTS_TO_PUBLISH}" | tr ',' '\n')
- 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://mosip.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'