-
Notifications
You must be signed in to change notification settings - Fork 62
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #322 from asubedy/components-workflow
Added components to doc workflow
- Loading branch information
Showing
1 changed file
with
63 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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/[email protected] | ||
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: '[email protected]' | ||
user_name: 'l5io' | ||
commit_msg: 'Adapters Component added' |