-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
9 additions
and
742 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 |
---|---|---|
|
@@ -31,13 +31,13 @@ jobs: | |
run: composer install --no-interaction --prefer-dist | ||
|
||
- name: Generate OpenAPI Specification JSON | ||
run: vendor/bin/openapi -o docs/openapi.json --format json src | ||
run: vendor/bin/openapi -o docs/latest-restapi.json --format json src | ||
|
||
- name: Upload REST API Specification | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: openapi-json | ||
path: docs/openapi.json | ||
name: restapi-json | ||
path: docs/latest-restapi.json | ||
|
||
deploy-docs: | ||
name: Deploy REST API Specification | ||
|
@@ -50,7 +50,7 @@ jobs: | |
node-version: 14 | ||
|
||
- name: Install openapi-checker | ||
run: npm install -g openapi-checker | ||
run: npm install -g swagger-cli | ||
|
||
- name: Checkout REST API Docs Repository | ||
uses: actions/checkout@v3 | ||
|
@@ -63,12 +63,13 @@ jobs: | |
uses: actions/download-artifact@v3 | ||
with: | ||
name: restapi-json | ||
path: docs | ||
|
||
- name: Validate OpenAPI Specification | ||
run: openapi-checker docs/openapi.json | ||
run: swagger-cli validate docs/latest-restapi.json | ||
|
||
- name: Compare Specifications | ||
run: git diff --no-index --output=restapi-diff.txt docs/openapi.json restapi.json || true | ||
run: git diff --no-index --output=restapi-diff.txt docs/latest-restapi.json restapi.json || true | ||
|
||
- name: Check Differences and Decide Deployment | ||
id: allow-deploy | ||
|
@@ -84,9 +85,9 @@ jobs: | |
- name: Commit and Deploy Updates | ||
if: env.DEPLOY == 'true' | ||
run: | | ||
mv docs/openapi.json docs/restapi.json | ||
mv docs/latest-restapi.json docs/restapi.json | ||
git config user.name "github-actions" | ||
git config user.email "[email protected]" | ||
git add docs/restapi.json | ||
git commit -m "Update REST API documentation `date`" | ||
git push origin main --force | ||
git push |
Oops, something went wrong.