-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update api generation workflow (#190)
- Loading branch information
1 parent
94780de
commit 503696d
Showing
14 changed files
with
143 additions
and
96 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 |
---|---|---|
|
@@ -19,42 +19,48 @@ jobs: | |
input_string: ${{ github.event.inputs.tag }} | ||
version_extractor_regex: '\/v(.*)$' | ||
|
||
# - uses: actions/checkout@v2 | ||
# with: | ||
# token: ${{ secrets.DEV_GITHUB_TOKEN }} | ||
# | ||
# - name: Install swagger-codegen | ||
# run: brew install swagger-codegen | ||
# | ||
# - name: Set up JDK 11 | ||
# uses: actions/setup-java@v2 | ||
# with: | ||
# java-version: '11' | ||
# distribution: 'adopt' | ||
# | ||
# - name: Npm install | ||
# run: npm install | ||
# | ||
# - name: Generate api pages for netbird main openapi definition | ||
# run: | | ||
# swagger-codegen generate -i https://raw.githubusercontent.com/netbirdio/netbird/v${{ steps.semver_parser.outputs.fullversion }}/management/server/http/api/openapi.yml -l openapi -o generator/openapi | ||
# npx ts-node generator/index.ts gen --input generator/openapi/openapi.json --output src/pages/ipa/resources | ||
# | ||
# - name: Check git diff and send to output | ||
# id: git_diff | ||
# run: | | ||
# if git --no-pager diff --exit-code; then | ||
# echo "changed=false" >> "$GITHUB_OUTPUT" | ||
# else | ||
# echo "changed=true" >> "$GITHUB_OUTPUT" | ||
# fi | ||
# | ||
# - name: Commit and push changes | ||
# if: steps.git_diff.outputs.changed == 'true' | ||
# run: | | ||
# git config --global user.email "[email protected]" | ||
# git config --global user.name "netbirddev" | ||
# | ||
# git add -A | ||
# git commit -m "Update API pages with v${{ steps.semver_parser.outputs.fullversion }}" | ||
# git push | ||
- uses: actions/checkout@v2 | ||
with: | ||
token: ${{ secrets.DEV_GITHUB_TOKEN }} | ||
|
||
- name: Create directory | ||
run: mkdir -p generator/openapi | ||
|
||
- name: Download openapi.yml | ||
run: curl -L -o generator/openapi/openapi.yml "https://raw.githubusercontent.com/netbirdio/netbird/v${{ steps.semver_parser.outputs.fullversion }}/management/server/http/api/openapi.yml" | ||
|
||
- name: Install Go | ||
uses: actions/setup-go@v3 | ||
with: | ||
go-version: '1.21.1' | ||
|
||
- name: Build Go project | ||
run: (cd ./generator && go build -o expandOpenAPIRef) | ||
|
||
- name: Expand openapi.yml | ||
run: (cd ./generator && ./expandOpenAPIRef) | ||
|
||
- name: Npm install | ||
run: npm install | ||
|
||
- name: Generate api pages for netbird main openapi definition | ||
run: npx ts-node generator/index.ts gen --input generator/openapi/expanded.yml --output src/pages/ipa/resources | ||
|
||
- name: Check git diff and send to output | ||
id: git_diff | ||
run: | | ||
if git --no-pager diff --exit-code; then | ||
echo "changed=false" >> "$GITHUB_OUTPUT" | ||
else | ||
echo "changed=true" >> "$GITHUB_OUTPUT" | ||
fi | ||
- name: Commit and push changes | ||
if: steps.git_diff.outputs.changed == 'true' | ||
run: | | ||
git config --global user.email "[email protected]" | ||
git config --global user.name "netbirddev" | ||
git add -A | ||
git commit -m "Update API pages with v${{ steps.semver_parser.outputs.fullversion }}" | ||
git push |
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 |
---|---|---|
|
@@ -26,3 +26,4 @@ package-lock.json | |
/yarn.lock | ||
/generator/openapi/ | ||
/generator/openapi.yml | ||
/generator/expandOpenAPIRef |
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
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
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
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
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
Oops, something went wrong.