Skip to content

Commit

Permalink
Tweak typedoc action
Browse files Browse the repository at this point in the history
  • Loading branch information
pluma4345 committed Jan 6, 2025
1 parent 80b5c5b commit 737bd68
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 23 deletions.
35 changes: 18 additions & 17 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,27 +33,28 @@ jobs:
- run: npm install -g npm@10
- run: npm install

- name: Set TAG env to devel (default)
- name: Set VERSION env to devel (default)
run: |
echo "TAG=devel" >> $GITHUB_ENV
echo "VERSION=devel" >> $GITHUB_ENV
echo "IS_PREVIEW=1" >> $GITHUB_ENV
echo "IS_BACKPORT=0" >> $GITHUB_ENV
- name: Set TAG env to ref tag
if: startsWith( github.event.ref, 'refs/tags/v' )
- name: Set VERSION env from tag name
if: startsWith(github.ref, 'refs/tags/v')
run: |
export TAG=$(echo ${{ github.event.ref }} | sed -e 's/^refs\/tags\/v//')
echo "TAG=${TAG}" >> $GITHUB_ENV
echo "IS_PREVIEW=$(node -p "Number('${TAG}'.includes('-'))")" >> $GITHUB_ENV
echo "IS_BACKPORT=$(node -p "Number(require('semver').lt('${TAG}','$(tail -n 1 gh-pages/VERSION.md)'))")" >> $GITHUB_ENV
export REF_NAME=${{github.ref_name}}
export VERSION=${REF_NAME:1}
echo "VERSION=${VERSION}" >> $GITHUB_ENV
echo "IS_PREVIEW=$(node -p "Number('${VERSION}'.includes('-'))")" >> $GITHUB_ENV
echo "IS_BACKPORT=$(node -p "Number(require('semver').lt('${VERSION}','$(tail -n 1 gh-pages/VERSION.md)'))")" >> $GITHUB_ENV
- name: Update VERSION / latest
if: env.IS_PREVIEW != 1
if: env.IS_BACKPORT != 1 && env.IS_PREVIEW != 1
run: |
echo '---\npermalink: /VERSION\ntitle: "VERSION"\n---\n' > gh-pages/VERSION.md
echo $TAG >> gh-pages/VERSION
echo $VERSION >> gh-pages/VERSION
unlink gh-pages/latest
ln -s $TAG gh-pages/latest
ln -s $VERSION gh-pages/latest
- name: Update CHANGELOG / MIGRATING
if: env.IS_BACKPORT != 1
Expand All @@ -65,24 +66,24 @@ jobs:
- name: Remove old docs if present
run: |
rm -rf gh-pages/${TAG}
rm -rf gh-pages/${VERSION}
- name: Rebuild docs for tag
if: env.TAG != 'devel'
if: env.VERSION != 'devel'
run: |
./node_modules/.bin/typedoc --includeVersion --gitRevision ${TAG} --out gh-pages/${TAG}
./node_modules/.bin/typedoc --includeVersion --gitRevision ${{ github.ref_name }} --out gh-pages/${VERSION}
node -p 'var all=fs.readdirSync("gh-pages",{withFileTypes:true}).flatMap(f=>f.isDirectory()&&!isNaN(f.name.charAt(0))?[f.name]:[]).sort(require("semver").rcompare);JSON.stringify({all,stable:all.filter(s=>!s.includes("-"))})' > gh-pages/_data/versions.json
- name: Rebuild docs for devel
if: env.TAG == 'devel'
if: env.VERSION == 'devel'
run: |
./node_modules/.bin/typedoc --out gh-pages/${TAG}
./node_modules/.bin/typedoc --gitRevision ${{ github.sha }} --out gh-pages/${VERSION}
- name: Commit to gh-pages
uses: EndBug/add-and-commit@v9
with:
cwd: ./gh-pages
push: origin gh-pages --force
message: Update ${{ env.TAG }} docs via ${{ github.sha }}
message: Update ${{ env.VERSION }} docs via ${{ github.sha }}
env:
GITHUB_TOKEN: ${{ github.token }}
9 changes: 3 additions & 6 deletions typedoc.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
{
"out": "tsdoc",
"cacheBust": true,
"githubPages": true,
"disableSources": false,
"exclude": ["**/lib/*.ts", "**/test/*.ts"],
"basePath": "./src",
"gitRemote": "origin",
"visibilityFilters": {},
"intentionallyNotExported": [
"ArangojsError",
"ArangojsResponse",
"Blob",
"GeneratedAqlQuery"
],
"intentionallyNotExported": ["Blob", "GeneratedAqlQuery"],
"excludeInternal": true,
"excludeProtected": true,
"excludePrivate": true,
Expand Down

0 comments on commit 737bd68

Please sign in to comment.