Skip to content

Commit 8cc548a

Browse files
committed
Add flow to publish versioned releases of the documentation
1 parent cce0ef1 commit 8cc548a

File tree

1 file changed

+48
-33
lines changed

1 file changed

+48
-33
lines changed

.github/workflows/deploy-sdk.yml

Lines changed: 48 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ jobs:
101101
runs-on: ubuntu-latest
102102
permissions:
103103
contents: write
104-
environment: deploy
104+
# environment: deploy
105105
outputs:
106106
npm_tag: ${{ steps.determine_npm_tag.outputs.npm_tag }}
107107
steps:
@@ -112,7 +112,9 @@ jobs:
112112

113113
- name: Extract tag name
114114
id: get_tag
115-
run: echo "tag=${GITHUB_REF#refs/tags/sdk/}" >> $GITHUB_OUTPUT
115+
# ${GITHUB_REF#refs/tags/sdk/}
116+
# Hardcoded for testing
117+
run: echo "tag=10.0.1" >> $GITHUB_OUTPUT
116118

117119
- name: Test that tag version matches package.json version
118120
run: test "${{ steps.get_tag.outputs.tag }}" = "$(jq -r ".version" packages/sdk/package.json)" || exit 1
@@ -128,39 +130,38 @@ jobs:
128130
fi
129131
echo "npm_tag=$npm_tag" >> $GITHUB_OUTPUT
130132
131-
- name: Get build-output
132-
uses: actions/download-artifact@v5
133-
with:
134-
name: build-release
135-
path: packages/sdk
136-
137-
- uses: actions/setup-node@v4
138-
with:
139-
node-version: ${{ env.NODE_VERSION }}
140-
cache: yarn
141-
registry-url: 'https://registry.npmjs.org'
142-
143-
- name: Publish to NPM
144-
run: |
145-
yarn config set npmAuthToken $NPM_AUTH_TOKEN
146-
yarn workspace @concordium/web-sdk npm publish --tag ${{ steps.determine_npm_tag.outputs.npm_tag }}
147-
env:
148-
NPM_AUTH_TOKEN: '${{secrets.NPM_PUBLISH_TOKEN}}'
149-
150-
- name: Create a GitHub release
151-
uses: ncipollo/release-action@v1
152-
with:
153-
tag: sdk/${{ steps.get_tag.outputs.tag }}
154-
name: SDK Release v${{ steps.get_tag.outputs.tag }}
155-
draft: true
133+
# - name: Get build-output
134+
# uses: actions/download-artifact@v5
135+
# with:
136+
# name: build-release
137+
# path: packages/sdk
138+
139+
# - uses: actions/setup-node@v4
140+
# with:
141+
# node-version: ${{ env.NODE_VERSION }}
142+
# cache: yarn
143+
# registry-url: 'https://registry.npmjs.org'
144+
145+
# - name: Publish to NPM
146+
# run: |
147+
# yarn config set npmAuthToken $NPM_AUTH_TOKEN
148+
# yarn workspace @concordium/web-sdk npm publish --tag ${{ steps.determine_npm_tag.outputs.npm_tag }}
149+
# env:
150+
# NPM_AUTH_TOKEN: '${{secrets.NPM_PUBLISH_TOKEN}}'
151+
152+
# - name: Create a GitHub release
153+
# uses: ncipollo/release-action@v1
154+
# with:
155+
# tag: sdk/${{ steps.get_tag.outputs.tag }}
156+
# name: SDK Release v${{ steps.get_tag.outputs.tag }}
157+
# draft: true
156158

157159
deploy-typedoc:
158160
needs:
159161
- upload-release
160-
if: needs.upload-release.outputs.npm_tag == 'latest'
161-
environment:
162-
name: github-pages
163-
url: ${{ steps.deployment.outputs.page_url }}
162+
# environment:
163+
# name: github-pages
164+
# url: ${{ steps.deployment.outputs.page_url }}
164165
runs-on: ubuntu-22.04
165166
steps:
166167
- name: Checkout
@@ -175,10 +176,24 @@ jobs:
175176
- name: Setup Pages
176177
uses: actions/configure-pages@v5
177178

178-
- name: Upload GH pages artifact
179+
# Put docs into a versioned subfolder
180+
- name: Move typedoc into versioned folder
181+
run: |
182+
VERSION=${{ steps.get_tag.outputs.tag }}
183+
mkdir -p docs/$VERSION
184+
cp -r typedoc/* docs/latest
185+
186+
# (Optional) symlink "latest" → newest tag
187+
- name: Update latest symlink
188+
if: needs.upload-release.outputs.npm_tag == 'latest'
189+
run: |
190+
rm -rf docs/latest
191+
mv typedoc/* docs/$VERSION
192+
193+
- name: Upload GH Pages artifact
179194
uses: actions/upload-pages-artifact@v3
180195
with:
181-
path: './typedoc'
196+
path: './docs'
182197

183198
- name: Deploy to GitHub Pages
184199
id: deployment

0 commit comments

Comments
 (0)