Skip to content

Commit

Permalink
Swagger-UI for public API (#345)
Browse files Browse the repository at this point in the history
add swagger-ui for public API with R2 upload
  • Loading branch information
andres-spacemesh authored Jun 14, 2024
1 parent 75bc24b commit daa9ca0
Show file tree
Hide file tree
Showing 8 changed files with 4,265 additions and 0 deletions.
42 changes: 42 additions & 0 deletions .github/workflows/swagger_build-deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Build and Push Swagger-UI to R2 mainnet-api-docs.spacemesh.network

on:
push:
branches:
- master
paths:
- 'release/openapi/swagger/src/**'

jobs:
build-deploy:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- name: Use Node.js v20.14.0
uses: actions/setup-node@v3
with:
node-version: '20.14.0'

- name: npm install
run: npm install
working-directory: release/openapi/swagger

- name: npm build
run: npm run build
working-directory: release/openapi/swagger

- uses: actions/upload-artifact@v3
with:
name: swagger-ui-build
path: release/openapi/swagger/dist

- uses: jakejarvis/s3-sync-action@master
with:
args: --acl public-read --follow-symlinks --delete
env:
AWS_S3_BUCKET: ${{ secrets.CLOUDFLARE_BUCKET }}
AWS_ACCESS_KEY_ID: ${{ secrets.CLOUDFLARE_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.CLOUDFLARE_SECRET_ACCESS_KEY }}
SOURCE_DIR: release/openapi/swagger/dist
DEST_DIR: ''
AWS_S3_ENDPOINT: https://${{ secrets.CLOUDFLARE_ACCOUNT_ID }}.r2.cloudflarestorage.com
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
.idea
bin/
release/openapi/swagger/node_modules
release/openapi/swagger/dist
10 changes: 10 additions & 0 deletions release/openapi/swagger/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<title>Spacemesh Public API Documentation</title>
</head>
<body>
<div id="swagger"></div>
</body>
</html>
Loading

0 comments on commit daa9ca0

Please sign in to comment.