-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0d794cc
commit ddd5d0d
Showing
2 changed files
with
89 additions
and
90 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 |
---|---|---|
|
@@ -13,7 +13,8 @@ jobs: | |
name: Check if the version has been updated | ||
outputs: | ||
has_changed: ${{ steps.check.outputs.has_changed }} | ||
version: ${{ steps.versions.outputs.new_version }} | ||
id: ${{ steps.versions.outputs.new_version }} | ||
version: ${{ steps.versions.outputs.version_only }} | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
@@ -23,6 +24,8 @@ jobs: | |
run: | | ||
NEW_VERSION=$(jq -r '.["$id"]' schemas/applications/schema/application.schema.json) | ||
echo "new_version=${NEW_VERSION}" >> $GITHUB_OUTPUT | ||
IFS='/' read -a id_array <<< "$NEW_VERSION" | ||
echo "version_only=${id_array[1]}" >> $GITHUB_OUTPUT | ||
git checkout HEAD^ | ||
PREV_VERSION=$( jq -r '.["$id"]' schemas/applications/schema/application.schema.json) | ||
echo "prev_version=${PREV_VERSION}" >> $GITHUB_OUTPUT | ||
|
@@ -36,92 +39,88 @@ jobs: | |
needs: check-version | ||
name: Bundle & Host JSON schema | ||
runs-on: ubuntu-latest | ||
if: ${{ needs.check-version.outputs.has_changed == 'true' }} | ||
steps: | ||
- name: test | ||
if: ${{ needs.check-version.outputs.has_changed == 'true' }} | ||
run: | ||
ls | ||
# - uses: actions/checkout@v3 | ||
# # Build Docusaurus | ||
# - name: Setup node in docs | ||
# uses: actions/setup-node@v3 | ||
# with: | ||
# node-version: "16" | ||
# cache: "npm" | ||
# cache-dependency-path: "docs/package-lock.json" | ||
# | ||
# - name: Cache docusaurus | ||
# uses: actions/cache@v3 | ||
# with: | ||
# path: | | ||
# ${{ github.workspace }}/docs/.docusaurus | ||
# key: | | ||
# ${{ runner.os }}-docusaurus | ||
# restore-keys: | | ||
# ${{ runner.os }}-docusaurus | ||
# | ||
# - name: Install dependencies | ||
# run: | | ||
# npm ci --prefix docs | ||
# | ||
# - name: Lint / Formatting | ||
# run: | | ||
# npm run typecheck --prefix docs | ||
# # TODO: should add more in the future if needed | ||
# | ||
# - name: Build | ||
# run: | | ||
# npm run build --prefix docs | ||
# | ||
# # Fetch API documentation | ||
# - uses: aica-technology/.github/.github/actions/[email protected] | ||
# with: | ||
# token: ${{ secrets.GITHUB_TOKEN }} | ||
# | ||
# - uses: aica-technology/.github/.github/actions/[email protected] | ||
# id: ensure-image | ||
# with: | ||
# image_name: aica-technology/backend-api-docs | ||
# | ||
# - name: Get API version to fetch | ||
# id: api-version | ||
# run: | | ||
# VER="$(cat docs/api.version)" | ||
# echo "Version: $VER" | ||
# echo "version=$VER" >> $GITHUB_OUTPUT | ||
# | ||
# - name: Create directory | ||
# run: | | ||
# mkdir -p docs/build/api | ||
# | ||
# - name: Extract Swagger from the built image | ||
# uses: aica-technology/.github/.github/actions/[email protected] | ||
# with: | ||
# image: ${{ steps.ensure-image.outputs.image_name }}:${{ steps.api-version.outputs.version }} | ||
# source: /index.html | ||
# destination: docs/build/api/index.html | ||
# | ||
# # Bundle JSON schema | ||
# - name: Setup node in utils | ||
# uses: actions/setup-node@v3 | ||
# with: | ||
# node-version: "16" | ||
# cache: "npm" | ||
# cache-dependency-path: "utils/package-lock.json" | ||
# - name: Install dependencies | ||
# run: | | ||
# cd utils | ||
# npm i | ||
# pip3 install javascript | ||
# - name: Bundle Schemas | ||
# run: | | ||
# python3 utils/bundle.py schemas/applications/schema/application.schema.json application.schema.json | ||
# ls | ||
# mkdir -p docs/build/schema/0-0-0 | ||
# mv application.schema.json docs/build/schema/0-0-0/application.schema.json | ||
# | ||
# - name: Deploy | ||
# uses: peaceiris/actions-gh-pages@v3 | ||
# with: | ||
# github_token: ${{ secrets.GITHUB_TOKEN }} | ||
# publish_dir: docs/build | ||
- uses: actions/checkout@v3 | ||
# Build Docusaurus | ||
- name: Setup node in docs | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: "16" | ||
cache: "npm" | ||
cache-dependency-path: "docs/package-lock.json" | ||
|
||
- name: Cache docusaurus | ||
uses: actions/cache@v3 | ||
with: | ||
path: | | ||
${{ github.workspace }}/docs/.docusaurus | ||
key: | | ||
${{ runner.os }}-docusaurus | ||
restore-keys: | | ||
${{ runner.os }}-docusaurus | ||
- name: Install dependencies | ||
run: | | ||
npm ci --prefix docs | ||
- name: Lint / Formatting | ||
run: | | ||
npm run typecheck --prefix docs | ||
# TODO: should add more in the future if needed | ||
- name: Build | ||
run: | | ||
npm run build --prefix docs | ||
# Fetch API documentation | ||
- uses: aica-technology/.github/.github/actions/[email protected] | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- uses: aica-technology/.github/.github/actions/[email protected] | ||
id: ensure-image | ||
with: | ||
image_name: aica-technology/backend-api-docs | ||
|
||
- name: Get API version to fetch | ||
id: api-version | ||
run: | | ||
VER="$(cat docs/api.version)" | ||
echo "Version: $VER" | ||
echo "version=$VER" >> $GITHUB_OUTPUT | ||
- name: Create directory | ||
run: | | ||
mkdir -p docs/build/api | ||
- name: Extract Swagger from the built image | ||
uses: aica-technology/.github/.github/actions/[email protected] | ||
with: | ||
image: ${{ steps.ensure-image.outputs.image_name }}:${{ steps.api-version.outputs.version }} | ||
source: /index.html | ||
destination: docs/build/api/index.html | ||
|
||
# Bundle JSON schema | ||
- name: Setup node in utils | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: "16" | ||
cache: "npm" | ||
cache-dependency-path: "utils/package-lock.json" | ||
- name: Install dependencies | ||
run: | | ||
cd utils | ||
npm i | ||
pip3 install javascript | ||
- name: Bundle Schemas | ||
run: | | ||
python3 utils/bundle.py schemas/applications/schema/application.schema.json application.schema.json | ||
mkdir -p docs/build/schema/${{ steps.versions.outputs.version }} | ||
mv application.schema.json docs/build/schema${{ steps.versions.outputs.id }} | ||
- name: Deploy | ||
uses: peaceiris/actions-gh-pages@v3 | ||
with: | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
publish_dir: docs/build |
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