Skip to content

Commit 7c33018

Browse files
committed
Automatically determine latest tags for the docs
1 parent 41ef1c3 commit 7c33018

File tree

5 files changed

+51
-27
lines changed

5 files changed

+51
-27
lines changed

SpotifyAPI.Docs/docs.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,14 @@ set -e
44

55
echo "Building docs..."
66

7+
export LATEST_VERSION="$(git tag --sort=committerdate | grep -E '[0-9]' | tail -1)"
8+
9+
echo "Set LATEST_VERSION to ${LATEST_VERSION}"
10+
711
git config --global user.email "[email protected]"
812
git config --global user.name "GH Actions Docs Builder"
913

1014
cd ./SpotifyAPI.Docs
1115
pnpm i --frozen-lockfile
16+
1217
USE_SSH=true GIT_USER=JohnnyCrazy pnpm run deploy

SpotifyAPI.Docs/docs/getting_started.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,8 @@ There is no online documentation for every available API call, but XML inline do
7777
* [Personalization](https://github.com/JohnnyCrazy/SpotifyAPI-NET/blob/master/SpotifyAPI.Web/Clients/Interfaces/IPersonalizationClient.cs)
7878
* [Episodes](https://github.com/JohnnyCrazy/SpotifyAPI-NET/blob/master/SpotifyAPI.Web/Clients/Interfaces/IEpisodesClient.cs)
7979
* [Library](https://github.com/JohnnyCrazy/SpotifyAPI-NET/blob/master/SpotifyAPI.Web/Clients/Interfaces/ILibraryClient.cs)
80+
* [Audiobooks](https://github.com/JohnnyCrazy/SpotifyAPI-NET/blob/master/SpotifyAPI.Web/Clients/Interfaces/IAudiobooksClient.cs)
81+
* [Chapters](https://github.com/JohnnyCrazy/SpotifyAPI-NET/blob/master/SpotifyAPI.Web/Clients/Interfaces/IChaptersClient.cs)
8082

8183
All calls have the [Spotify Web API documentation reference](https://developer.spotify.com/documentation/web-api/reference-beta/) attached as a remark.
8284

SpotifyAPI.Docs/docusaurus.config.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ module.exports = {
88
favicon: 'img/favicon.ico',
99
organizationName: 'JohnnyCrazy', // Usually your GitHub org/user name.
1010
projectName: 'SpotifyAPI-NET', // Usually your repo name.
11+
customFields: {
12+
LATEST_VERSION: process.env.LATEST_VERSION ?? '?.?.?',
13+
},
1114
themeConfig: {
1215
prism: {
1316
additionalLanguages: ['csharp'],

SpotifyAPI.Docs/pnpm-lock.yaml

Lines changed: 33 additions & 20 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

SpotifyAPI.Docs/src/install_instructions.js

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,27 @@
1+
import useDocusaurusContext from '@docusaurus/useDocusaurusContext';
12
import CodeBlock from '@theme/CodeBlock';
23
import TabItem from '@theme/TabItem';
34
import Tabs from '@theme/Tabs';
45
import React from 'react';
56

6-
const VERSION = '7.1.1';
7-
87
const installCodeNuget = `Install-Package SpotifyAPI.Web
98
# Optional Auth module, which includes an embedded HTTP Server for OAuth2
109
Install-Package SpotifyAPI.Web.Auth
1110
`;
1211

13-
const installReference = `<PackageReference Include="SpotifyAPI.Web" Version="${VERSION}" />
14-
<!-- Optional Auth module, which includes an embedded HTTP Server for OAuth2 -->
15-
<PackageReference Include="SpotifyAPI.Web.Auth" Version="${VERSION}" />
16-
`;
17-
1812
const installCodeCLI = `dotnet add package SpotifyAPI.Web
1913
# Optional Auth module, which includes an embedded HTTP Server for OAuth2
2014
dotnet add package SpotifyAPI.Web.Auth
2115
`;
2216

2317
const InstallInstructions = () => {
18+
const { siteConfig } = useDocusaurusContext();
19+
20+
const installReference = `<PackageReference Include="SpotifyAPI.Web" Version="${siteConfig.customFields.LATEST_VERSION}" />
21+
<!-- Optional Auth module, which includes an embedded HTTP Server for OAuth2 -->
22+
<PackageReference Include="SpotifyAPI.Web.Auth" Version="${siteConfig.customFields.LATEST_VERSION}" />
23+
`;
24+
2425
return (
2526
<div style={{ padding: '10px' }}>
2627
<Tabs

0 commit comments

Comments
 (0)