diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index d9ec3e5..ae1e889 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -31,6 +31,8 @@ jobs: - name: Build run: pnpm build working-directory: website + env: + DOCS_VERSION: ${{ startsWith(github.ref, 'refs/tags/') && github.ref_name || '' }} - uses: actions/upload-pages-artifact@v4 with: diff --git a/website/docusaurus.config.js b/website/docusaurus.config.js index 72d598d..70869a4 100644 --- a/website/docusaurus.config.js +++ b/website/docusaurus.config.js @@ -1,5 +1,16 @@ // @ts-check +const version = process.env.DOCS_VERSION || 'dev'; + +/** @param {string} str */ +function escapeHtml(str) { + return str + .replace(/&/g, '&') + .replace(//g, '>') + .replace(/"/g, '"'); +} + /** @type {import('@docusaurus/types').Config} */ const config = { // title: 'backlog-cli', @@ -58,6 +69,11 @@ const config = { type: 'localeDropdown', position: 'right', }, + { + type: 'html', + position: 'right', + value: `${escapeHtml(version)}`, + }, { href: 'https://github.com/23prime/backlog-cli', label: 'GitHub',