-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add api reference generation (#82)
* feat: add api reference generation * chore: add current reference, logo, favicon
- Loading branch information
Showing
15 changed files
with
25,988 additions
and
0 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,76 @@ | ||
# update-admin-api-reference.yml | ||
name: Update Admin API Reference | ||
|
||
on: | ||
schedule: | ||
# Run at seven every Monday | ||
- cron: '0 7 * * 1' | ||
workflow_dispatch: # Manual trigger | ||
|
||
jobs: | ||
update-admin-api-reference: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout GaloyMoney/blink repo | ||
uses: actions/checkout@v3 | ||
with: | ||
repository: 'GaloyMoney/blink' | ||
path: 'blink' | ||
fetch-depth: 0 | ||
|
||
- name: Get current commit hash | ||
run: echo "CURRENT_COMMIT_HASH=$(git -C blink rev-parse HEAD)" >> $GITHUB_ENV | ||
|
||
- name: Hash current schema.graphql | ||
run: | | ||
echo "CURRENT_HASH=$(sha256sum blink/core/api/src/graphql/admin/schema.graphql | awk '{ print $1 }')" >> $GITHUB_ENV | ||
- name: Checkout GaloyMoney/blink to a week ago | ||
run: | | ||
week_old_commit=$(git -C blink rev-list -n 1 --before='1 week ago' main) | ||
echo "Check out to the commit: $week_old_commit" | ||
git -C blink checkout $week_old_commit | ||
- name: Hash the week old schema.graphql | ||
run: echo "WEEK_OLD_HASH=$(sha256sum blink/core/api/src/graphql/admin/schema.graphql | awk '{ print $1 }')" >> $GITHUB_ENV | ||
|
||
- name: Check if hashes are the same | ||
if: env.CURRENT_HASH == env.WEEK_OLD_HASH | ||
run: | | ||
echo "There were no changes to the admin API schema during the last week." | ||
- name: Checkout dev.blink.sv repo | ||
if: env.CURRENT_HASH != env.WEEK_OLD_HASH | ||
uses: actions/checkout@v3 | ||
with: | ||
repository: 'GaloyMoney/dev.blink.sv' | ||
path: 'dev.blink.sv' | ||
ref: 'main' | ||
fetch-depth: 0 | ||
|
||
- name: Build and update the API reference | ||
if: env.CURRENT_HASH != env.WEEK_OLD_HASH | ||
run: | | ||
# deps | ||
yarn add spectaql --non-interactive | ||
# checkout blink | ||
cd blink | ||
git checkout ${{ env.CURRENT_COMMIT_HASH }} | ||
# build admin api reference | ||
npx spectaql ../dev.blink.sv/scripts/spectaql/spectaql-config-admin-api.yml \ | ||
-t ../dev.blink.sv/static -f admin-api-reference.html | ||
# set dark mode | ||
sed -i 's/spectaql.min.css/spectaql.dark.css/' ../dev.blink.sv/static/admin-api-reference.html | ||
# commit and push changes | ||
cd ../dev.blink.sv | ||
git config --local user.name 'github-actions[bot]' | ||
git config --local user.email 'github-actions[bot]@users.noreply.github.com' | ||
git add . | ||
short_commit_hash=$(echo ${{ env.CURRENT_COMMIT_HASH }} | cut -c 1-7) | ||
git commit -m "docs: admin api reference update to blink commit $short_commit_hash" | ||
git push origin main |
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,76 @@ | ||
# update-public-api-reference.yml | ||
name: Update Public API Reference | ||
|
||
on: | ||
schedule: | ||
# Run at six every Monday | ||
- cron: '0 6 * * 1' | ||
workflow_dispatch: # Manual trigger | ||
|
||
jobs: | ||
update-public-api-reference: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout GaloyMoney/blink repo | ||
uses: actions/checkout@v3 | ||
with: | ||
repository: 'GaloyMoney/blink' | ||
path: 'blink' | ||
fetch-depth: 0 | ||
|
||
- name: Get current commit hash | ||
run: echo "CURRENT_COMMIT_HASH=$(git -C blink rev-parse HEAD)" >> $GITHUB_ENV | ||
|
||
- name: Hash current schema.graphql | ||
run: | | ||
echo "CURRENT_HASH=$(sha256sum blink/core/api/src/graphql/public/schema.graphql | awk '{ print $1 }')" >> $GITHUB_ENV | ||
- name: Checkout GaloyMoney/blink to a week ago | ||
run: | | ||
week_old_commit=$(git -C blink rev-list -n 1 --before='1 week ago' main) | ||
echo "Check out to the commit: $week_old_commit" | ||
git -C blink checkout $week_old_commit | ||
- name: Hash the week old schema.graphql | ||
run: echo "WEEK_OLD_HASH=$(sha256sum blink/core/api/src/graphql/public/schema.graphql | awk '{ print $1 }')" >> $GITHUB_ENV | ||
|
||
- name: Check if hashes are the same | ||
if: env.CURRENT_HASH == env.WEEK_OLD_HASH | ||
run: | | ||
echo "There were no changes to the public API schema during the last week." | ||
- name: Checkout dev.blink.sv repo | ||
if: env.CURRENT_HASH != env.WEEK_OLD_HASH | ||
uses: actions/checkout@v3 | ||
with: | ||
repository: 'GaloyMoney/dev.blink.sv' | ||
path: 'dev.blink.sv' | ||
ref: 'main' | ||
fetch-depth: 0 | ||
|
||
- name: Build and update the API reference | ||
if: env.CURRENT_HASH != env.WEEK_OLD_HASH | ||
run: | | ||
# deps | ||
yarn add spectaql --non-interactive | ||
# checkout blink | ||
cd blink | ||
git checkout ${{ env.CURRENT_COMMIT_HASH }} | ||
# build public api reference | ||
npx spectaql ../dev.blink.sv/scripts/spectaql/spectaql-config-public-api.yml \ | ||
-t ../dev.blink.sv/static -f public-api-reference.html | ||
# set dark mode | ||
sed -i 's/spectaql.min.css/spectaql.dark.css/' ../dev.blink.sv/static/public-api-reference.html | ||
# commit and push changes | ||
cd ../dev.blink.sv | ||
git config --local user.name 'github-actions[bot]' | ||
git config --local user.email 'github-actions[bot]@users.noreply.github.com' | ||
git add . | ||
short_commit_hash=$(echo ${{ env.CURRENT_COMMIT_HASH }} | cut -c1-7) | ||
git commit -m "docs: public api reference update to blink commit $short_commit_hash" | ||
git push origin main |
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 |
---|---|---|
|
@@ -7,6 +7,7 @@ | |
# Generated files | ||
.docusaurus | ||
.cache-loader | ||
.temp | ||
|
||
# Misc | ||
.DS_Store | ||
|
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,23 @@ | ||
#!/bin/bash | ||
|
||
# deps | ||
if ! git --version; then sudo apt-get install -y git; fi | ||
if ! node --version; then sudo apt-get install -y nodejs; fi | ||
if ! yarn --version; then sudo apt-get install -y yarn; fi | ||
if ! npx spectaql --version; then yarn add spectaql --non-interactive; fi | ||
|
||
mkdir -p .temp | ||
cd .temp || exit 1 | ||
|
||
# checkout blink | ||
if [ ! -d "galoy" ]; then | ||
git clone https://github.com/GaloyMoney/blink | ||
fi | ||
cd blink || exit 1 | ||
|
||
# build admin api reference | ||
npx spectaql ./../../scripts/spectaql/spectaql-config-admin-api.yml \ | ||
-t ./../../static -f admin-api-reference.html || exit 1 | ||
|
||
# set dark mode | ||
sed -i 's/spectaql.min.css/spectaql.dark.css/' ./../../static/admin-api-reference.html |
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,23 @@ | ||
#!/bin/bash | ||
|
||
# deps | ||
if ! git --version; then sudo apt-get install -y git; fi | ||
if ! node --version; then sudo apt-get install -y nodejs; fi | ||
if ! yarn --version; then sudo apt-get install -y yarn; fi | ||
if ! npx spectaql --version; then yarn add spectaql --non-interactive; fi | ||
|
||
mkdir -p .temp | ||
cd .temp || exit 1 | ||
|
||
# checkout blink | ||
if [ ! -d "galoy" ]; then | ||
git clone https://github.com/GaloyMoney/blink | ||
fi | ||
cd blink || exit 1 | ||
|
||
# build public api reference | ||
npx spectaql ./../../scripts/spectaql/spectaql-config-public-api.yml \ | ||
-t ./../../static -f public-api-reference.html || exit 1 | ||
|
||
# set dark mode | ||
sed -i 's/spectaql.min.css/spectaql.dark.css/' ./../../static/public-api-reference.html |
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,21 @@ | ||
spectaql: | ||
logoFile: /static/images/logo.png | ||
faviconFile: /static/images/favicon.ico | ||
|
||
introspection: | ||
schemaFile: ./core/api/src/graphql/admin/schema.graphql | ||
|
||
info: | ||
title: GraphQL Admin API Reference | ||
description: Welcome to the Blink Admin API reference! | ||
contact: | ||
name: Galoy developer community | ||
url: https://chat.galoy.io/ | ||
license: | ||
name: MIT | ||
url: https://opensource.org/licenses/MIT | ||
|
||
servers: | ||
- url: https://admin-api.staging.galoy.io/graphql | ||
description: Signet | ||
production: false |
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,20 @@ | ||
spectaql: | ||
logoFile: /static/images/logo.png | ||
faviconFile: /static/images/favicon.ico | ||
introspection: | ||
schemaFile: ./core/api/src/graphql/public/schema.graphql | ||
|
||
info: | ||
title: GraphQL API Reference | ||
description: Welcome to the Blink API reference! | ||
contact: | ||
name: Galoy developer community | ||
url: https://chat.galoy.io/ | ||
license: | ||
name: MIT | ||
url: https://opensource.org/licenses/MIT | ||
|
||
servers: | ||
- url: https://api.staging.blink.sv/graphql | ||
description: Signet | ||
production: false |
Oops, something went wrong.