From 379160723112b1edeb01820146154ea6d0279381 Mon Sep 17 00:00:00 2001 From: asubedy Date: Tue, 11 Oct 2022 18:53:32 +0530 Subject: [PATCH] Added components to doc workflow Signed-off-by: asubedy --- .github/workflows/components-to-doc.yml | 63 +++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 .github/workflows/components-to-doc.yml diff --git a/.github/workflows/components-to-doc.yml b/.github/workflows/components-to-doc.yml new file mode 100644 index 0000000..417a314 --- /dev/null +++ b/.github/workflows/components-to-doc.yml @@ -0,0 +1,63 @@ +name: Components to Documents +on: + push: + paths: + - templates/oam/workloads** + release: + types: [published] + +jobs: + CopyComponents: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + + - name: Make components to .md files + run: | + + function join_by { + local d=${1-} f=${2-} + if shift 2; then + echo "$f${@/#/$d}" + + fi + } + mkdir output + folder_path=templates/oam/workloads/* + for file in $folder_path; + do + folder_name="$file/*" + onlyfolder=$(basename "$file") + echo "--- + component: $onlyfolder + integrations:" > $onlyfolder.md + for indFile in $folder_name; + do + filename=$(basename "$indFile") + temp_filename=$filename + IFS="." + read -ra newarr <<< "$temp_filename" + IFS="" + if [[ "${newarr[7]}" == "schema" ]] + then + continue + fi + ans=$(join_by . ${newarr[0]} ${newarr[1]}) + echo " - $ans" >> $onlyfolder.md + done + echo "---" >> $onlyfolder.md + mv $onlyfolder.md output + done + + - name: Pushes folder to main repo + uses: crykn/copy_folder_to_another_repo_action@v1.0.6 + env: + API_TOKEN_GITHUB: ${{ secrets.GH_ACCESS_TOKEN }} + with: + source_folder: 'output' + destination_repo: 'meshery/meshery' + destination_folder: 'docs/_integrations/consul' + destination_branch: 'master' + user_email: 'ci@layer5.io' + user_name: 'l5io' + commit_msg: 'Adapters Component added' \ No newline at end of file