-
Notifications
You must be signed in to change notification settings - Fork 588
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 #1902 from vishalvivekm/gh-action
chore: update action to copy catalog items to meshery docs
- Loading branch information
Showing
1 changed file
with
46 additions
and
8 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 |
---|---|---|
|
@@ -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 | ||
|
@@ -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) | ||
|
@@ -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] | ||
|