-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Customize GitHub pages workflow. (#215)
Signed-off-by: dblock <[email protected]>
- Loading branch information
Showing
7 changed files
with
103 additions
and
30 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 |
---|---|---|
@@ -0,0 +1,44 @@ | ||
# deploys to https://opensearch-project.github.io/opensearch-api-specification/ | ||
name: Deploy | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
concurrency: | ||
group: "pages" | ||
cancel-in-progress: false | ||
|
||
permissions: | ||
contents: write | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout the repo | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup Node.js | ||
uses: actions/setup-node@v2 | ||
with: | ||
node-version: '20' | ||
|
||
- name: Setup Ruby | ||
uses: ruby/setup-ruby@v1 | ||
with: | ||
ruby-version: '3.3' | ||
bundler-cache: true | ||
|
||
- name: Build with Jekyll | ||
run: |- | ||
gem install jekyll | ||
jekyll build | ||
- name: Deploy 🚀 | ||
uses: JamesIves/github-pages-deploy-action@v4 | ||
with: | ||
folder: _site | ||
branch: gh-pages | ||
|
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 |
---|---|---|
|
@@ -8,4 +8,7 @@ node_modules | |
.idea/ | ||
|
||
# VSCode files | ||
.vscode/ | ||
.vscode/ | ||
|
||
# Jekyll Website | ||
_site/ |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
source: . | ||
destination: ./_site | ||
include: | ||
- index.html | ||
- favicon.ico | ||
exclude: | ||
- '*' | ||
keep_files: | ||
- opensearch-openapi.yaml |
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 |
---|---|---|
@@ -0,0 +1,16 @@ | ||
module OpenAPI | ||
def self.generate(_site, _payload) | ||
return if @generated | ||
|
||
Dir.chdir('tools') do | ||
system 'npm install' | ||
system 'npm run merge -- ../spec/opensearch-openapi.yaml ../_site/opensearch-openapi.yaml' | ||
end | ||
|
||
@generated = true | ||
end | ||
end | ||
|
||
Jekyll::Hooks.register :site, :post_write do |site, payload| | ||
OpenAPI.generate(site, payload) | ||
end |
Binary file not shown.
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 |
---|---|---|
@@ -1,29 +1,30 @@ | ||
<html> | ||
<head> | ||
<!-- Load the latest Swagger UI code and style from npm using unpkg.com --> | ||
<script src="https://unpkg.com/swagger-ui-dist@4/swagger-ui-bundle.js"></script> | ||
<link rel="stylesheet" type="text/css" href="https://unpkg.com/swagger-ui-dist@4/swagger-ui.css"/> | ||
<title>OpenSearch API Spec</title> | ||
</head> | ||
<body> | ||
<div id="swagger-ui"></div> <!-- Div to hold the UI component --> | ||
<script> | ||
window.onload = function () { | ||
// Begin Swagger UI call region | ||
const ui = SwaggerUIBundle({ | ||
url: "https://github.com/opensearch-project/opensearch-api-specification/releases/download/main/opensearch-openapi.yaml", | ||
dom_id: '#swagger-ui', | ||
deepLinking: true, | ||
presets: [ | ||
SwaggerUIBundle.presets.apis, | ||
SwaggerUIBundle.SwaggerUIStandalonePreset | ||
], | ||
plugins: [ | ||
SwaggerUIBundle.plugins.DownloadUrl | ||
], | ||
}) | ||
window.ui = ui | ||
} | ||
</script> | ||
</body> | ||
</html> | ||
|
||
<head> | ||
<script src="https://unpkg.com/swagger-ui-dist@5/swagger-ui-bundle.js"></script> | ||
<link rel="stylesheet" type="text/css" href="https://unpkg.com/swagger-ui-dist@5/swagger-ui.css" /> | ||
<title>OpenSearch API Spec</title> | ||
</head> | ||
|
||
<body> | ||
<div id="swagger-ui"></div> | ||
<script> | ||
window.onload = function () { | ||
const ui = SwaggerUIBundle({ | ||
url: "opensearch-openapi.yaml", | ||
dom_id: "#swagger-ui", | ||
deepLinking: true, | ||
presets: [ | ||
SwaggerUIBundle.presets.apis, | ||
SwaggerUIBundle.SwaggerUIStandalonePreset | ||
], | ||
plugins: [ | ||
SwaggerUIBundle.plugins.DownloadUrl | ||
], | ||
}) | ||
window.ui = ui | ||
} | ||
</script> | ||
</body> | ||
|
||
</html> |