Skip to content
This repository was archived by the owner on Nov 29, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions .github/workflows/lts-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
run: |
LTS_TIME=$(jq -r 'first(.[] | select(.name | match(".+LTS")) | .published_at)' <<< $(curl -Ls -H "Accept: application/vnd.github+json" -H "Authorization: token $TOKEN" $GITHUB_API_URL/repos/$GITHUB_REPOSITORY/releases)) # Get latest LTS version release time
read REL_TIME REL_ID REL_NAME REL_ZIP < <(echo $(curl -Ls -H "Accept: application/vnd.github+json" -H "Authorization: token $TOKEN" $GITHUB_API_URL/repos/$GITHUB_REPOSITORY/releases/latest | jq -r '.published_at, .id, .name, .zipball_url')) # Get info about latest release
if [ $REL_TIME '>' $LTS_TIME ]; then curl -s -X PATCH -H "Accept: application/vnd.github+json" -H "Authorization: token $TOKEN" $GITHUB_API_URL/repos/$GITHUB_REPOSITORY/releases/$REL_ID -d '{"name":"'"${REL_NAME}-LTS"'"}' > /dev/null; echo "::set-output name=new_lts_zip::$REL_ZIP"; echo "::set-output name=release_name::$REL_NAME"; else echo "::set-output name=no_release::true"; fi # If there has been a non-LTS release since the last LTS release, create a new LTS release
if [ $REL_TIME '>' $LTS_TIME ]; then curl -s -X PATCH -H "Accept: application/vnd.github+json" -H "Authorization: token $TOKEN" $GITHUB_API_URL/repos/$GITHUB_REPOSITORY/releases/$REL_ID -d '{"name":"'"${REL_NAME}-LTS"'"}' > /dev/null; echo "new_lts_zip=$REL_ZIP" >> $GITHUB_OUTPUT; echo "release_name=$REL_NAME" >> $GITHUB_OUTPUT; else echo "no_release=true" >> $GITHUB_OUTPUT; fi # If there has been a non-LTS release since the last LTS release, create a new LTS release
env:
TOKEN: ${{ secrets.DX_GITHUB_TOKEN }}

Expand All @@ -31,7 +31,9 @@ jobs:
- name: Download, Extract, and Build Site from Release
run: |
mkdir lts; curl -Lfs -H "Accept: application/vnd.github+json" -H "Authorization: token $TOKEN" $LTS_ZIP --output lts.zip; unzip -q lts.zip -d lts # Get and Unzip Release Archive
cd $(find ./ -type d -name "site"); mv ./* ../../; cd ../../; yarn install --pure-lockfile; yarn build # Build Static Site
cd $(find ./ -type d -name "site"); mv ./* ../../; cd ../../ # Move contents of site directory to root of unzipped folder
tmpfile=$(mktemp); cp custom.config.json $tmpfile; jq "(.[] | select(.)) |= gsub(\"main\"; \"$REL_NAME\")" $tmpfile > custom.config.json; rm -f -- "$tmpfile" # Update Config for Spec Download Links
yarn install --pure-lockfile; yarn build # Install Packages and Build Static Site
env:
TOKEN: ${{ secrets.DX_GITHUB_TOKEN }}
LTS_ZIP: ${{ needs.lts_needed.outputs.new_lts_zip }}
Expand All @@ -41,7 +43,7 @@ jobs:
id: bucket_name
run: |
BUCKET_NAME=$(echo "bandwidth-api-docs-${BUCKET_NAME}" | tr '[:upper:]' '[:lower:]' | sed -e "s/[^a-z0-9]/-/g") #convert to lowercase and convert non-alphanumerics with dashes
echo "::set-output name=bucket_name::$BUCKET_NAME"
echo "bucket_name=$BUCKET_NAME" >> $GITHUB_OUTPUT
env:
BUCKET_NAME: ${{ needs.lts_needed.outputs.release_name }}

Expand Down
12 changes: 12 additions & 0 deletions site/custom.config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"numbersSpecLink": "https://github.com/Bandwidth/api-docs/blob/main/site/specs/numbers.yml",
"phoneNumberLookupSpecLink": "https://github.com/Bandwidth/api-docs/blob/main/site/specs/phone-number-lookup.yml",
"voiceSpecLink": "https://github.com/Bandwidth/api-docs/blob/main/site/specs/voice.yml",
"messagingSpecLink": "https://github.com/Bandwidth/api-docs/blob/main/site/specs/messaging.yml",
"messagingInternationalSpecLink": "https://github.com/Bandwidth/api-docs/blob/main/site/specs/messagingInternational.json",
"webRtcSpecLink": "https://github.com/Bandwidth/api-docs/blob/main/site/specs/webrtc.yml",
"multiFactorAuthSpecLink": "https://github.com/Bandwidth/api-docs/blob/main/site/specs/multi-factor-auth.yml",
"dashSpecLink": "https://github.com/Bandwidth/api-docs/blob/main/site/specs/dash.json",
"dashNotificationsSpecLink": "https://github.com/Bandwidth/api-docs/blob/main/site/specs/dashNotifications.json",
"insightsSpecLink": "https://github.com/Bandwidth/api-docs/blob/main/site/specs/insights.yml"
}
11 changes: 11 additions & 0 deletions site/docusaurus.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ const YAML = require('yaml');
const fs = require('fs');
const path = require('path');

const customConfig = require('./custom.config.json');
const numbersSpec = fs.readFileSync('./specs/numbers.yml', 'utf-8');
const phoneNumberLookupSpec = fs.readFileSync('./specs/phone-number-lookup.yml', 'utf-8');
const voiceSpec = fs.readFileSync('./specs/voice.yml', 'utf-8');
Expand Down Expand Up @@ -125,19 +126,29 @@ module.exports = {
],
customFields: {
numbersSpec: YAML.parse(numbersSpec),
numbersSpecLink: `${customConfig.numbersSpecLink}`,
phoneNumberLookupSpec: YAML.parse(phoneNumberLookupSpec),
phoneNumberLookupSpecLink: `${customConfig.phoneNumberLookupSpecLink}`,
voiceSpec: YAML.parse(voiceSpec),
voiceSpecLink: `${customConfig.voiceSpecLink}`,
messagingSpec: YAML.parse(messagingSpec),
messagingSpecLink: `${customConfig.messagingSpecLink}`,
messagingInternationalSpec: JSON.parse(messagingInternationalSpec),
messagingInternationalSpecLink: `${customConfig.messagingInternationalSpecLink}`,
webRTCSpec: YAML.parse(webRtcSpec),
webRtcSpecLink: `${customConfig.webRtcSpecLink}`,
multiFactorAuthSpec: YAML.parse(multiFactorAuthSpec),
multiFactorAuthSpecLink: `${customConfig.multiFactorAuthSpecLink}`,
dashSpec: JSON.parse(dashSpec),
dashSpecLink: `${customConfig.dashSpecLink}`,
dashNotificationsSpec: JSON.parse(dashNotificationsSpec),
dashNotificationsSpecLink: `${customConfig.dashNotificationsSpecLink}`,
globalSpec: YAML.parse(globalSpec),
globalSpec_v2: YAML.parse(globalSpec_v2),
globalSpec_v3: YAML.parse(globalSpec_v3),
globalSpec_beta: YAML.parse(globalSpec_beta),
insightsSpec: YAML.parse(insightsSpec),
insightsSpecLink: `${customConfig.insightsSpecLink}`,

// CSS Colors
bwBlue: '#079CEE',
Expand Down
Loading