Skip to content

Commit

Permalink
Merge pull request #1902 from vishalvivekm/gh-action
Browse files Browse the repository at this point in the history
chore: update action to copy catalog items to meshery docs
  • Loading branch information
leecalcote committed Sep 18, 2024
2 parents 00e8d33 + 502589b commit e2c0bfa
Showing 1 changed file with 46 additions and 8 deletions.
54 changes: 46 additions & 8 deletions .github/workflows/add-catalog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,33 +11,48 @@ jobs:
outputs:
contentID: ${{ steps.update_catalog_patterns.outputs.contentID }}
steps:
- name: Checkout Code
- name: Checkout meshery.io repo
uses: actions/checkout@v4
with:
path: meshery.io
token: ${{ secrets.GH_ACCESS_TOKEN }}

- name: Checkout meshery/meshery repo
uses: actions/checkout@v4
with:
repository: meshery/meshery
path: meshery
token: ${{ secrets.GH_ACCESS_TOKEN }}

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.21'

- name: Set env
run: |
echo "MESHERY_CLOUD_BASE_URL=https://meshery.layer5.io" >> $GITHUB_ENV
echo "MESHERY_CATALOG_FILES_DIR=catalog" >> $GITHUB_ENV
- name: Cleanup
working-directory: ./meshery.io
run: |
find $MESHERY_CATALOG_FILES_DIR ! -name 'index.html' ! -name 'artifacthub-repo.yml' -maxdepth 1 -type f -delete
cd ./collections/_catalog
for dir in */; do find $dir -maxdepth 1 -type f -delete; done
cd ../../
- id: update_catalog_patterns
name: Update Catalog Patterns in Go
working-directory: ./meshery.io/assets/artifact-hub-pkg
run: |
cd assets/artifact-hub-pkg
go run package.go
env:
GH_ACCESS_TOKEN: ${{ secrets.GH_ACCESS_TOKEN }}

- name: Update Catalog Filters
if: ${{ success() }}
working-directory: ./meshery.io
run: |
catalogFilters=$(curl -sS "$MESHERY_CLOUD_BASE_URL/api/catalog/content/filter" 2>./err.txt)
if [[ "$(<err.txt)" != "" ]]; then
Expand All @@ -49,8 +64,6 @@ jobs:
filterCount=$(echo "$catalogFilters" | jq '.total_count')
echo "Found $filterCount catalog filters"
echo "Found $filterCount catalog filters"
for (( idx=0; idx<$filterCount; idx++ ))
do
filterId=$(jq -r .[$idx].id temp.json)
Expand Down Expand Up @@ -126,18 +139,43 @@ jobs:
done
rm temp.json
- name: Pull changes from remote
run: git pull origin master
- name: copy catalog directory to docs
run: |
mkdir -p meshery/docs/_catalog
cp -R meshery.io/collections/_catalog/* meshery/docs/_catalog/
- name: Commit
- name: Pull latest changes from meshery/meshery
run: |
cd meshery
git pull origin master
- name: Commit changes to meshery/meshery repo
uses: stefanzweifel/git-auto-commit-action@v4
with:
file_pattern: catalog/* collections/_catalog/*
repository: ./meshery
commit_user_name: l5io
commit_user_email: [email protected]
commit_author: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com>
commit_options: "--signoff"
commit_message: "[Docs] Update _catalog collection"
branch: master

- name: Pull latest changes from meshery.io
run: |
cd meshery.io
git pull origin master
- name: Commit changes to meshery.io repo
uses: stefanzweifel/git-auto-commit-action@v5
with:
repository: ./meshery.io
commit_user_name: l5io
commit_user_email: [email protected]
commit_author: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com>
commit_options: '--signoff'
commit_message: '[Catalog] Update Catalog items'
branch: master

- name: Send Email on Workflow Failure
if: ${{ failure() }}
uses: dawidd6/[email protected]
Expand Down

0 comments on commit e2c0bfa

Please sign in to comment.