1010
1111# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
1212permissions :
13- contents : read
13+ contents : write
1414 pages : write
1515 id-token : write
1616
@@ -33,68 +33,68 @@ jobs:
3333 with :
3434 submodules : ' recursive'
3535
36- - uses : actions/setup-node@v4
37- with :
38- node-version : ${{ env.NODE_VERSION }}
39- cache : yarn
36+ # - uses: actions/setup-node@v4
37+ # with:
38+ # node-version: ${{ env.NODE_VERSION }}
39+ # cache: yarn
4040
41- - name : Install rust
42- run : rustup default ${{ env.RUST_VERSION }}
41+ # - name: Install rust
42+ # run: rustup default ${{ env.RUST_VERSION }}
4343
44- - uses : Swatinem/rust-cache@v2
45- with :
46- workspaces : |
47- packages/rust-bindings
48- deps/concordium-base/rust-src
49- deps/concordium-base/smart-contracts/contracts-common
50-
51- - name : Cache dependencies
52- id : yarn-cache
53- uses : actions/cache@v4
54- with :
55- path : |
56- ./node_modules
57- ./docs/node_modules
58- ./packages/*/node_modules
59- ./examples/**/node_modules
60- key : ${{ runner.os }}-yarn-${{ hashFiles('yarn.lock') }}
61- restore-keys : |
62- ${{ runner.os }}-yarn-${{ hashFiles('yarn.lock') }}
63-
64- - name : Cache GRPC
65- id : cache-grpc
66- uses : actions/cache@v4
67- with :
68- path : |
69- ./packages/sdk/src/grpc-api
70- key : ${{ runner.os }}-grpc-${{ hashFiles('deps/concordium-base/concordium-grpc-api') }}
71- restore-keys : ${{ runner.os }}-grpc
44+ # - uses: Swatinem/rust-cache@v2
45+ # with:
46+ # workspaces: |
47+ # packages/rust-bindings
48+ # deps/concordium-base/rust-src
49+ # deps/concordium-base/smart-contracts/contracts-common
50+
51+ # - name: Cache dependencies
52+ # id: yarn-cache
53+ # uses: actions/cache@v4
54+ # with:
55+ # path: |
56+ # ./node_modules
57+ # ./docs/node_modules
58+ # ./packages/*/node_modules
59+ # ./examples/**/node_modules
60+ # key: ${{ runner.os }}-yarn-${{ hashFiles('yarn.lock') }}
61+ # restore-keys: |
62+ # ${{ runner.os }}-yarn-${{ hashFiles('yarn.lock') }}
63+
64+ # - name: Cache GRPC
65+ # id: cache-grpc
66+ # uses: actions/cache@v4
67+ # with:
68+ # path: |
69+ # ./packages/sdk/src/grpc-api
70+ # key: ${{ runner.os }}-grpc-${{ hashFiles('deps/concordium-base/concordium-grpc-api') }}
71+ # restore-keys: ${{ runner.os }}-grpc
7272
73- - name : Get dependencies
74- if : steps.yarn-cache.outputs.cache-hit != 'true'
75- run : yarn install --immutable
73+ # - name: Get dependencies
74+ # if: steps.yarn-cache.outputs.cache-hit != 'true'
75+ # run: yarn install --immutable
7676
77- - name : Build release
78- run : yarn build:all
77+ # - name: Build release
78+ # run: yarn build:all
7979
80- - name : Generate typedoc documentation
81- run : yarn build:docs
80+ # - name: Generate typedoc documentation
81+ # run: yarn build:docs
8282
83- - name : Store build-release
84- uses : actions/upload-artifact@v4
85- with :
86- name : build-release
87- path : |
88- packages/sdk/lib
89- packages/sdk/src
90- packages/sdk/package.json
91- packages/sdk/README.md
92-
93- - name : Store typedoc
94- uses : actions/upload-artifact@v4
95- with :
96- name : typedoc-build
97- path : typedoc
83+ # - name: Store build-release
84+ # uses: actions/upload-artifact@v4
85+ # with:
86+ # name: build-release
87+ # path: |
88+ # packages/sdk/lib
89+ # packages/sdk/src
90+ # packages/sdk/package.json
91+ # packages/sdk/README.md
92+
93+ # - name: Store typedoc
94+ # uses: actions/upload-artifact@v4
95+ # with:
96+ # name: typedoc-build
97+ # path: typedoc
9898
9999 upload-release :
100100 needs : build
@@ -110,25 +110,25 @@ jobs:
110110 with :
111111 submodules : recursive
112112
113- - name : Extract tag name
114- id : get_tag
115- # ${GITHUB_REF#refs/tags/sdk/}
116- # Hardcoded for testing
117- run : echo "tag=10.0.1" >> $GITHUB_OUTPUT
118-
119- - name : Test that tag version matches package.json version
120- run : test "${{ steps.get_tag.outputs.tag }}" = "$(jq -r ".version" packages/sdk/package.json)" || exit 1
121-
122- - name : Determine npm tag
123- id : determine_npm_tag
124- run : |
125- version=$(jq -r ".version" packages/sdk/package.json)
126- if [[ "$version" == *-* ]]; then
127- npm_tag=$(echo "$version" | cut -d'-' -f2 | cut -d'.' -f1)
128- else
129- npm_tag="latest"
130- fi
131- echo "npm_tag=$npm_tag" >> $GITHUB_OUTPUT
113+ # - name: Extract tag name
114+ # id: get_tag
115+ # # ${GITHUB_REF#refs/tags/sdk/}
116+ # # Hardcoded for testing
117+ # run: echo "tag=10.0.1" >> $GITHUB_OUTPUT
118+
119+ # - name: Test that tag version matches package.json version
120+ # run: test "${{ steps.get_tag.outputs.tag }}" = "$(jq -r ".version" packages/sdk/package.json)" || exit 1
121+
122+ # - name: Determine npm tag
123+ # id: determine_npm_tag
124+ # run: |
125+ # version=$(jq -r ".version" packages/sdk/package.json)
126+ # if [[ "$version" == *-* ]]; then
127+ # npm_tag=$(echo "$version" | cut -d'-' -f2 | cut -d'.' -f1)
128+ # else
129+ # npm_tag="latest"
130+ # fi
131+ # echo "npm_tag=$npm_tag" >> $GITHUB_OUTPUT
132132
133133 # - name: Get build-output
134134 # uses: actions/download-artifact@v5
@@ -159,42 +159,82 @@ jobs:
159159 deploy-typedoc :
160160 needs :
161161 - upload-release
162- # environment:
163- # name: github-pages
164- # url: ${{ steps.deployment.outputs.page_url }}
162+ environment :
163+ name : github-pages
165164 runs-on : ubuntu-22.04
166165 steps :
167166 - name : Checkout
168167 uses : actions/checkout@v5
169168
170- - name : Get typedoc
171- uses : actions/download-artifact@v5
172- with :
173- path : typedoc
174- name : typedoc-build
169+ # Get already published documentation
170+ # - name: Fetch old gh-pages content (old doc versions)
171+ # run: |
172+ # mkdir -p docs
173+ # if git ls-remote --exit-code origin gh-pages; then
174+ # echo "'gh-pages' branch does exist"
175+ # # Clone old `gh-pages` branch into temp folder
176+ # git clone --branch gh-pages --depth 1 https://github.com/${{ github.repository }} old-gh-pages
177+ # # Copy existing docs into 'docs/' folder
178+ # cp -r old-gh-pages/* docs/ || true
179+ # else
180+ # echo "'gh-pages' branch does not exist yet"
181+ # fi
182+
183+ # - name: Get typedoc
184+ # uses: actions/download-artifact@v5
185+ # with:
186+ # path: typedoc
187+ # name: typedoc-build
188+
189+ # TODO: remove again just for testing
190+ - name : Add some dummy docs
191+ run : |
192+ mkdir -p typedoc && echo 'docs dummy' > typedoc/index.html
175193
176194 - name : Setup Pages
177195 uses : actions/configure-pages@v5
178196
179- # Put docs into a versioned subfolder
180- - name : Move typedoc into versioned folder
197+ # Put new docs into a versioned subfolder
198+ # TODO: add this again => VERSION=${{ needs.upload-release.outputs.tag }}
199+ - name : Generate versioned subfolder
181200 run : |
182- VERSION=${{ steps.get_tag.outputs.tag }}
183- mkdir -p docs /$VERSION
184- cp -r typedoc/* docs/latest
201+ VERSION=10.0.2
202+ mkdir -p gh-pages /$VERSION
203+ cp -r typedoc/* gh-pages/$VERSION
185204
186- # (Optional) symlink "latest" → newest tag
187- - name : Update latest symlink
188- if : needs.upload-release.outputs.npm_tag == 'latest'
205+ # Update the "latest" subfolder content with the newest doc version.
206+ - name : Update ` latest` subfolder content
207+ # TODO: add this again => if: needs.upload-release.outputs.npm_tag == 'latest'
189208 run : |
190- rm -rf docs/latest
191- mv typedoc/* docs/$VERSION
209+ mkdir -p gh-pages/latest
210+ rm -rf gh-pages/latest/*
211+ cp -r typedoc/* gh-pages/latest
192212
193- - name : Upload GH Pages artifact
194- uses : actions/upload-pages-artifact@v3
213+ - name : Deploy
214+ uses : peaceiris/actions-gh-pages@v4
195215 with :
196- path : ' ./docs'
216+ github_token : ${{ secrets.GITHUB_TOKEN }}
217+ publish_dir : ./gh-pages
218+ keep_files : true
197219
198- - name : Deploy to GitHub Pages
199- id : deployment
200- uses : actions/deploy-pages@v4
220+ # Generate list of available documentation versions.
221+ # This needs to be done after the `gh-pages` branch has been updated by above `Deploy` run.
222+ - name : Generate docs index
223+ run : |
224+ echo "<!DOCTYPE html>" > gh-pages/index.html
225+ echo "<html><head><title>Documentation Versions</title></head><body>" >> gh-pages/index.html
226+ echo "<h1>Available Documentation Versions</h1><ul>" >> gh-pages/index.html
227+
228+ # Loop over directories in gh-pages branch
229+ for d in $(git ls-tree -d --name-only origin/gh-pages); do
230+ echo "<li><a href=\"./$d/\">$d</a></li>" >> gh-pages/index.html
231+ done
232+ echo "</ul>" >> gh-pages/index.html
233+ echo "</body></html>" >> gh-pages/index.html
234+
235+ - name : Deploy again (this time with updated `list of available documentation versions`)
236+ uses : peaceiris/actions-gh-pages@v4
237+ with :
238+ github_token : ${{ secrets.GITHUB_TOKEN }}
239+ publish_dir : ./gh-pages
240+ keep_files : true
0 commit comments