Skip to content
This repository was archived by the owner on Nov 29, 2023. It is now read-only.

Commit 6a69236

Browse files
authored
DX-2866 Update Spec Download Button Links (#782)
* DX-2866 Update Spec Download Button Links * remove old numbers.json * use custom config * add command * update to use new github output
1 parent bbaaf75 commit 6a69236

File tree

14 files changed

+38
-35439
lines changed

14 files changed

+38
-35439
lines changed

.github/workflows/lts-release.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
run: |
1919
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
2020
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
21-
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
21+
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
2222
env:
2323
TOKEN: ${{ secrets.DX_GITHUB_TOKEN }}
2424

@@ -31,7 +31,9 @@ jobs:
3131
- name: Download, Extract, and Build Site from Release
3232
run: |
3333
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
34-
cd $(find ./ -type d -name "site"); mv ./* ../../; cd ../../; yarn install --pure-lockfile; yarn build # Build Static Site
34+
cd $(find ./ -type d -name "site"); mv ./* ../../; cd ../../ # Move contents of site directory to root of unzipped folder
35+
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
36+
yarn install --pure-lockfile; yarn build # Install Packages and Build Static Site
3537
env:
3638
TOKEN: ${{ secrets.DX_GITHUB_TOKEN }}
3739
LTS_ZIP: ${{ needs.lts_needed.outputs.new_lts_zip }}
@@ -41,7 +43,7 @@ jobs:
4143
id: bucket_name
4244
run: |
4345
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
44-
echo "::set-output name=bucket_name::$BUCKET_NAME"
46+
echo "bucket_name=$BUCKET_NAME" >> $GITHUB_OUTPUT
4547
env:
4648
BUCKET_NAME: ${{ needs.lts_needed.outputs.release_name }}
4749

site/custom.config.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"numbersSpecLink": "https://github.com/Bandwidth/api-docs/blob/main/site/specs/numbers.yml",
3+
"phoneNumberLookupSpecLink": "https://github.com/Bandwidth/api-docs/blob/main/site/specs/phone-number-lookup.yml",
4+
"voiceSpecLink": "https://github.com/Bandwidth/api-docs/blob/main/site/specs/voice.yml",
5+
"messagingSpecLink": "https://github.com/Bandwidth/api-docs/blob/main/site/specs/messaging.yml",
6+
"messagingInternationalSpecLink": "https://github.com/Bandwidth/api-docs/blob/main/site/specs/messagingInternational.json",
7+
"webRtcSpecLink": "https://github.com/Bandwidth/api-docs/blob/main/site/specs/webrtc.yml",
8+
"multiFactorAuthSpecLink": "https://github.com/Bandwidth/api-docs/blob/main/site/specs/multi-factor-auth.yml",
9+
"dashSpecLink": "https://github.com/Bandwidth/api-docs/blob/main/site/specs/dash.json",
10+
"dashNotificationsSpecLink": "https://github.com/Bandwidth/api-docs/blob/main/site/specs/dashNotifications.json",
11+
"insightsSpecLink": "https://github.com/Bandwidth/api-docs/blob/main/site/specs/insights.yml"
12+
}

site/docusaurus.config.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ const YAML = require('yaml');
22
const fs = require('fs');
33
const path = require('path');
44

5+
const customConfig = require('./custom.config.json');
56
const numbersSpec = fs.readFileSync('./specs/numbers.yml', 'utf-8');
67
const phoneNumberLookupSpec = fs.readFileSync('./specs/phone-number-lookup.yml', 'utf-8');
78
const voiceSpec = fs.readFileSync('./specs/voice.yml', 'utf-8');
@@ -125,19 +126,29 @@ module.exports = {
125126
],
126127
customFields: {
127128
numbersSpec: YAML.parse(numbersSpec),
129+
numbersSpecLink: `${customConfig.numbersSpecLink}`,
128130
phoneNumberLookupSpec: YAML.parse(phoneNumberLookupSpec),
131+
phoneNumberLookupSpecLink: `${customConfig.phoneNumberLookupSpecLink}`,
129132
voiceSpec: YAML.parse(voiceSpec),
133+
voiceSpecLink: `${customConfig.voiceSpecLink}`,
130134
messagingSpec: YAML.parse(messagingSpec),
135+
messagingSpecLink: `${customConfig.messagingSpecLink}`,
131136
messagingInternationalSpec: JSON.parse(messagingInternationalSpec),
137+
messagingInternationalSpecLink: `${customConfig.messagingInternationalSpecLink}`,
132138
webRTCSpec: YAML.parse(webRtcSpec),
139+
webRtcSpecLink: `${customConfig.webRtcSpecLink}`,
133140
multiFactorAuthSpec: YAML.parse(multiFactorAuthSpec),
141+
multiFactorAuthSpecLink: `${customConfig.multiFactorAuthSpecLink}`,
134142
dashSpec: JSON.parse(dashSpec),
143+
dashSpecLink: `${customConfig.dashSpecLink}`,
135144
dashNotificationsSpec: JSON.parse(dashNotificationsSpec),
145+
dashNotificationsSpecLink: `${customConfig.dashNotificationsSpecLink}`,
136146
globalSpec: YAML.parse(globalSpec),
137147
globalSpec_v2: YAML.parse(globalSpec_v2),
138148
globalSpec_v3: YAML.parse(globalSpec_v3),
139149
globalSpec_beta: YAML.parse(globalSpec_beta),
140150
insightsSpec: YAML.parse(insightsSpec),
151+
insightsSpecLink: `${customConfig.insightsSpecLink}`,
141152

142153
// CSS Colors
143154
bwBlue: '#079CEE',

0 commit comments

Comments
 (0)