Skip to content

Commit

Permalink
Automatically determine latest tags for the docs
Browse files Browse the repository at this point in the history
  • Loading branch information
JohnnyCrazy committed Oct 12, 2024
1 parent 41ef1c3 commit 7c33018
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 27 deletions.
5 changes: 5 additions & 0 deletions SpotifyAPI.Docs/docs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,14 @@ set -e

echo "Building docs..."

export LATEST_VERSION="$(git tag --sort=committerdate | grep -E '[0-9]' | tail -1)"

echo "Set LATEST_VERSION to ${LATEST_VERSION}"

git config --global user.email "[email protected]"
git config --global user.name "GH Actions Docs Builder"

cd ./SpotifyAPI.Docs
pnpm i --frozen-lockfile

USE_SSH=true GIT_USER=JohnnyCrazy pnpm run deploy
2 changes: 2 additions & 0 deletions SpotifyAPI.Docs/docs/getting_started.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@ There is no online documentation for every available API call, but XML inline do
* [Personalization](https://github.com/JohnnyCrazy/SpotifyAPI-NET/blob/master/SpotifyAPI.Web/Clients/Interfaces/IPersonalizationClient.cs)
* [Episodes](https://github.com/JohnnyCrazy/SpotifyAPI-NET/blob/master/SpotifyAPI.Web/Clients/Interfaces/IEpisodesClient.cs)
* [Library](https://github.com/JohnnyCrazy/SpotifyAPI-NET/blob/master/SpotifyAPI.Web/Clients/Interfaces/ILibraryClient.cs)
* [Audiobooks](https://github.com/JohnnyCrazy/SpotifyAPI-NET/blob/master/SpotifyAPI.Web/Clients/Interfaces/IAudiobooksClient.cs)
* [Chapters](https://github.com/JohnnyCrazy/SpotifyAPI-NET/blob/master/SpotifyAPI.Web/Clients/Interfaces/IChaptersClient.cs)

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

Expand Down
3 changes: 3 additions & 0 deletions SpotifyAPI.Docs/docusaurus.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ module.exports = {
favicon: 'img/favicon.ico',
organizationName: 'JohnnyCrazy', // Usually your GitHub org/user name.
projectName: 'SpotifyAPI-NET', // Usually your repo name.
customFields: {
LATEST_VERSION: process.env.LATEST_VERSION ?? '?.?.?',
},
themeConfig: {
prism: {
additionalLanguages: ['csharp'],
Expand Down
53 changes: 33 additions & 20 deletions SpotifyAPI.Docs/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 8 additions & 7 deletions SpotifyAPI.Docs/src/install_instructions.js
Original file line number Diff line number Diff line change
@@ -1,26 +1,27 @@
import useDocusaurusContext from '@docusaurus/useDocusaurusContext';
import CodeBlock from '@theme/CodeBlock';
import TabItem from '@theme/TabItem';
import Tabs from '@theme/Tabs';
import React from 'react';

const VERSION = '7.1.1';

const installCodeNuget = `Install-Package SpotifyAPI.Web
# Optional Auth module, which includes an embedded HTTP Server for OAuth2
Install-Package SpotifyAPI.Web.Auth
`;

const installReference = `<PackageReference Include="SpotifyAPI.Web" Version="${VERSION}" />
<!-- Optional Auth module, which includes an embedded HTTP Server for OAuth2 -->
<PackageReference Include="SpotifyAPI.Web.Auth" Version="${VERSION}" />
`;

const installCodeCLI = `dotnet add package SpotifyAPI.Web
# Optional Auth module, which includes an embedded HTTP Server for OAuth2
dotnet add package SpotifyAPI.Web.Auth
`;

const InstallInstructions = () => {
const { siteConfig } = useDocusaurusContext();

const installReference = `<PackageReference Include="SpotifyAPI.Web" Version="${siteConfig.customFields.LATEST_VERSION}" />
<!-- Optional Auth module, which includes an embedded HTTP Server for OAuth2 -->
<PackageReference Include="SpotifyAPI.Web.Auth" Version="${siteConfig.customFields.LATEST_VERSION}" />
`;

return (
<div style={{ padding: '10px' }}>
<Tabs
Expand Down

0 comments on commit 7c33018

Please sign in to comment.