Skip to content

Commit

Permalink
Merge pull request #5 from linagora/fix-ci-update-docs
Browse files Browse the repository at this point in the history
fix: ci job update docs
  • Loading branch information
jcabannes authored Jan 9, 2024
2 parents 039b3d5 + 1809d50 commit 9ccd737
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 13 deletions.
25 changes: 14 additions & 11 deletions .github/workflows/github-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ jobs:
id: changed-files
uses: tj-actions/changed-files@v41
with:
files: ${{ github.workspace }}/packages/matrix-invite/**/*
files: packages/matrix-invite/**/*
- name: Build and publish matrix-invite docker image
if: steps.changed-files.outputs.test_any_changed == 'true'
uses: philips-software/[email protected]
Expand All @@ -71,6 +71,8 @@ jobs:
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.ref }}
- name: Set up Node LTS
uses: actions/setup-node@v3
with:
Expand All @@ -80,23 +82,24 @@ jobs:
- name: Generate Swagger documentation
run: npm run doc
- name: Check if documentation files has changed
id: changed-files
uses: tj-actions/changed-files@v41
id: verify-changed-files
uses: tj-actions/verify-changed-files@v17
with:
files: ${{ github.workspace }}/docs/openapi.json
files: docs/openapi.json
- name: Update documentation files
if: steps.changed-files.outputs.test_any_changed == 'true'
if: steps.verify-changed-files.outputs.files_changed == 'true'
env:
SPEC_TO_DISPLAY: "openapi.json"
DISABLE_TRY_IT_OUT_JS_METHOD: "const DisableTryItOutPlugin = function() {return {statePlugins:{spec:{wrapSelectors:{allowTryItOutFor:() => () => false}}}}}"
DISABLE_TRY_IT_OUT_PLUGIN: ", DisableTryItOutPlugin"
run: |
cp -rp node_modules/swagger-ui-dist/* ${{ github.workspace }}/docs
sed -i "/window\.onload\s=\sfunction()\s{/a $DISABLE_TRY_IT_OUT_JS_METHOD" ${{ github.workspace }}/docs/swagger-initializer.js
sed -i "s#https://petstore\.swagger\.io/v2/swagger\.json#$SPEC_TO_DISPLAY#g" ${{ github.workspace }}/docs/swagger-initializer.js
sed -i "/SwaggerUIBundle\.plugins\.DownloadUrl/a $DISABLE_TRY_IT_OUT_PLUGIN" ${{ github.workspace }}/docs/swagger-initializer.js
- name: Commit updated documentation files
yes | cp -rf node_modules/swagger-ui-dist/* docs
sed -i "/window\.onload\s=\sfunction()\s{/a $DISABLE_TRY_IT_OUT_JS_METHOD" docs/swagger-initializer.js
sed -i "s#https://petstore\.swagger\.io/v2/swagger\.json#$SPEC_TO_DISPLAY#g" docs/swagger-initializer.js
sed -i "/SwaggerUIBundle\.plugins\.DownloadUrl/a $DISABLE_TRY_IT_OUT_PLUGIN" docs/swagger-initializer.js
- name: Commit updated documentation files
if: steps.verify-changed-files.outputs.files_changed == 'true'
uses: EndBug/add-and-commit@v9
with:
add: ${{ github.workspace }}/docs
add: docs
message: 'chore: update documentation'
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
coverage/
dist/
docs/*
!docs/swagger.cjs
node_modules/
packages/*/example/*.js*
*.map
Expand Down

0 comments on commit 9ccd737

Please sign in to comment.