diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 000000000..c0ec9b73c --- /dev/null +++ b/.github/workflows/deploy.yml @@ -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 + diff --git a/.gitignore b/.gitignore index 875f8bce9..c13ed1f10 100644 --- a/.gitignore +++ b/.gitignore @@ -8,4 +8,7 @@ node_modules .idea/ # VSCode files -.vscode/ \ No newline at end of file +.vscode/ + +# Jekyll Website +_site/ diff --git a/PUBLISHING_SPECS.md b/PUBLISHING_SPECS.md index e9111a151..837dac89c 100644 --- a/PUBLISHING_SPECS.md +++ b/PUBLISHING_SPECS.md @@ -3,4 +3,4 @@ ## Publishing OpenSearch API Specs * The [build](.github/workflows/build.yml) workflow publishes [a release draft](https://github.com/opensearch-project/opensearch-api-specification/releases) whenever a change is pushed to `main`. -* The updated OpenAPI specs are hosted on GitHub pages at https://opensearch-project.github.io/opensearch-api-specification/. \ No newline at end of file +* The [deploy](.github/workflows/deploy.yml) workflow publishes specs to [GitHub pages](https://opensearch-project.github.io/opensearch-api-specification/). \ No newline at end of file diff --git a/_config.yml b/_config.yml new file mode 100644 index 000000000..0472d5b59 --- /dev/null +++ b/_config.yml @@ -0,0 +1,9 @@ +source: . +destination: ./_site +include: + - index.html + - favicon.ico +exclude: + - '*' +keep_files: + - opensearch-openapi.yaml diff --git a/_plugins/openapi.rb b/_plugins/openapi.rb new file mode 100644 index 000000000..82bae554f --- /dev/null +++ b/_plugins/openapi.rb @@ -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 diff --git a/favicon.ico b/favicon.ico new file mode 100644 index 000000000..dd2d62ece Binary files /dev/null and b/favicon.ico differ diff --git a/index.html b/index.html index 83dd24258..002d4ddf3 100644 --- a/index.html +++ b/index.html @@ -1,29 +1,30 @@ -
- - - -