@@ -33,27 +33,28 @@ jobs:
3333 - run : npm install -g npm@10
3434 - run : npm install
3535
36- - name : Set TAG env to devel (default)
36+ - name : Set VERSION env to devel (default)
3737 run : |
38- echo "TAG =devel" >> $GITHUB_ENV
38+ echo "VERSION =devel" >> $GITHUB_ENV
3939 echo "IS_PREVIEW=1" >> $GITHUB_ENV
4040 echo "IS_BACKPORT=0" >> $GITHUB_ENV
4141
42- - name : Set TAG env to ref tag
43- if : startsWith( github.event. ref, 'refs/tags/v' )
42+ - name : Set VERSION env from tag name
43+ if : startsWith(github.ref, 'refs/tags/v')
4444 run : |
45- export TAG=$(echo ${{ github.event.ref }} | sed -e 's/^refs\/tags\/v//')
46- echo "TAG=${TAG}" >> $GITHUB_ENV
47- echo "IS_PREVIEW=$(node -p "Number('${TAG}'.includes('-'))")" >> $GITHUB_ENV
48- echo "IS_BACKPORT=$(node -p "Number(require('semver').lt('${TAG}','$(tail -n 1 gh-pages/VERSION.md)'))")" >> $GITHUB_ENV
45+ export REF_NAME=${{github.ref_name}}
46+ export VERSION=${REF_NAME:1}
47+ echo "VERSION=${VERSION}" >> $GITHUB_ENV
48+ echo "IS_PREVIEW=$(node -p "Number('${VERSION}'.includes('-'))")" >> $GITHUB_ENV
49+ echo "IS_BACKPORT=$(node -p "Number(require('semver').lt('${VERSION}','$(tail -n 1 gh-pages/VERSION.md)'))")" >> $GITHUB_ENV
4950
5051 - name : Update VERSION / latest
51- if : env.IS_PREVIEW != 1
52+ if : env.IS_BACKPORT != 1 && env. IS_PREVIEW != 1
5253 run : |
5354 echo '---\npermalink: /VERSION\ntitle: "VERSION"\n---\n' > gh-pages/VERSION.md
54- echo $TAG >> gh-pages/VERSION
55+ echo $VERSION >> gh-pages/VERSION
5556 unlink gh-pages/latest
56- ln -s $TAG gh-pages/latest
57+ ln -s $VERSION gh-pages/latest
5758
5859 - name : Update CHANGELOG / MIGRATING
5960 if : env.IS_BACKPORT != 1
@@ -65,24 +66,24 @@ jobs:
6566
6667 - name : Remove old docs if present
6768 run : |
68- rm -rf gh-pages/${TAG }
69+ rm -rf gh-pages/${VERSION }
6970
7071 - name : Rebuild docs for tag
71- if : env.TAG != 'devel'
72+ if : env.VERSION != 'devel'
7273 run : |
73- ./node_modules/.bin/typedoc --includeVersion --gitRevision ${TAG} --out gh-pages/${TAG }
74+ ./node_modules/.bin/typedoc --includeVersion --gitRevision ${{ github.ref_name }} --out gh-pages/${VERSION }
7475 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
7576
7677 - name : Rebuild docs for devel
77- if : env.TAG == 'devel'
78+ if : env.VERSION == 'devel'
7879 run : |
79- ./node_modules/.bin/typedoc --out gh-pages/${TAG }
80+ ./node_modules/.bin/typedoc --gitRevision ${{ github.sha }} -- out gh-pages/${VERSION }
8081
8182 - name : Commit to gh-pages
8283 uses : EndBug/add-and-commit@v9
8384 with :
8485 cwd : ./gh-pages
8586 push : origin gh-pages --force
86- message : Update ${{ env.TAG }} docs via ${{ github.sha }}
87+ message : Update ${{ env.VERSION }} docs via ${{ github.sha }}
8788 env :
8889 GITHUB_TOKEN : ${{ github.token }}
0 commit comments