[MOSIP-29245] testing #31
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: reusable workflows | |
on: | |
release: | |
types: [published] | |
pull_request: | |
types: [opened, reopened, synchronize] | |
paths: | |
- 'charts/**' | |
workflow_dispatch: | |
inputs: | |
Message: | |
description: 'Message for manually triggering' | |
required: false | |
default: 'Triggered for Updates' | |
type: string | |
IGNORE_CHARTS: | |
description: 'Ignore linting for list of charts separated by pipe(|)' | |
required: false | |
default: 'reporting|reporting-init|activemq-artemis' | |
type: string | |
CHART_PUBLISH: | |
description: 'Chart publishing to gh-pages branch' | |
required: false | |
default: 'OFF' | |
type: string | |
push: | |
branches: | |
- '!release-branch' | |
- master | |
- 1.* | |
- develop | |
- MOSIP* | |
- release* | |
paths: | |
- 'charts/**' | |
env: | |
IGNORE_CHARTS: "reporting|reporting-init|activemq-artemis" | |
CHART_PUBLISH: "ON" | |
CHARTS_DIR: "charts" | |
jobs: | |
lint-chart: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Disable Chart publish for pull requests | |
run: | | |
REPO_URL=${{ github.event.pull_request.base.repo.html_url }} | |
BRANCH_NAME=${{ github.event.pull_request.base.ref }} | |
git remote -v | |
git remote add upstream $REPO_URL | |
CHARTS_MODIFIED=$( git diff --name-status upstream/$BRANCH_NAME | grep charts | awk -F/ '{print $2}' | sort | uniq | sed -z 's/\n/|^/g' ) | |
cd ${{ env.CHARTS_DIR }} | |
echo "IGNORE_CHARTS=$(ls -d * | grep -Ev \"$CHARTS_MODIFIED \")" >> $GITHUB_ENV | |
echo "CHART_PUBLISH=OFF" >> $GITHUB_ENV | |
if: "${{ github.event_name == 'pull_request' }}" | |
- name: Publish Helm charts | |
uses: syedsalman3753/syed-helm-gh-pages@master | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
charts_dir: ${{ env.CHARTS_DIR }} | |
ignore_charts: "${{ inputs.IGNORE_CHARTS || env.IGNORE_CHARTS }}" | |
chart_publish: "${{ inputs.CHART_PUBLISH || env.CHART_PUBLISH }}" | |
# Commented below tasks as it cannot test MOSIP helm/charts deployment due to dependencies issues | |
#- name: Create kind v1.21.1 cluster | |
# uses: helm/[email protected] | |
# with: | |
# node_image: kindest/node:v1.21.1 | |
# | |
#- name: Run chart-testing (install) | |
# run: | | |
# while read -r chart; do | |
# echo -e "\nCHART: $chart\n"; | |
# ct install --config=.github/chart-testing-config.yaml --charts=$chart --remote=target_repo --target-branch=$TARGET_BRANCH; | |
# done < ./list.txt |