Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 3 additions & 10 deletions .github/workflows/publish-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Generate new release
on:
push:
tags:
- 'v5*'
- "v5*"
jobs:
build:
runs-on: ubuntu-latest
Expand All @@ -14,7 +14,7 @@ jobs:
- uses: actions/setup-node@v4
with:
node-version: 20
registry-url: 'https://registry.npmjs.org'
registry-url: "https://registry.npmjs.org"
- name: git config
run: |
git config user.name "${GITHUB_ACTOR}"
Expand All @@ -30,15 +30,8 @@ jobs:
run: yarn --silent extract-changelog-release > RELEASE_BODY.md
- uses: ncipollo/release-action@v1
with:
bodyFile: 'RELEASE_BODY.md'
bodyFile: "RELEASE_BODY.md"
token: ${{ secrets.GITHUB_TOKEN }}
- name: Publish on gh-pages
run: |
git remote set-url origin https://git:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git
yarn storybook:build
yarn storybook:deploy
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- uses: italia/slack-notify-release-action@v0.4.0
with:
slack_token: ${{ secrets.SLACK_TOKEN }}
Expand Down
72 changes: 61 additions & 11 deletions .github/workflows/update-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,32 +2,82 @@ name: Update documentation

on:
workflow_dispatch:
push:
tags:
- "v5*"

permissions: {}

jobs:
deploy:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
fetch-depth: 0
persist-credentials: false

- name: Setup Node.js
uses: actions/setup-node@v4
uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
with:
node-version: '20.x'
node-version: 20
package-manager-cache: false

- name: Git config
run: |
git config user.name "${GITHUB_ACTOR}"
git config user.email "${GITHUB_ACTOR}@users.noreply.github.com"

- name: Install dependencies
run: yarn
- name: Build documentation

- name: Build docs
run: yarn storybook:build

- name: Extract destination folder name
run: |
yarn build
- name: Publish on gh-pages
if [[ "${GITHUB_REF_TYPE}" == "tag" ]]; then
if [[ "${GITHUB_REF_NAME}" =~ ^v5\.[0-9]+\.[0-9]+$ ]]; then
echo "DEST_FOLDER=${GITHUB_REF_NAME}" >> $GITHUB_ENV
else
echo "Invalid tag format: ${GITHUB_REF_NAME}. Expected v5.<minor>.<patch>" >&2
exit 1
fi
else
echo "DEST_FOLDER=latest" >> $GITHUB_ENV
fi

- name: Deploy docs
uses: peaceiris/actions-gh-pages@47f197a2200bb9de68ba5f48fad1c088eb1c4a32 # v4.0.0
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./storybook-static
destination_dir: ${{ env.DEST_FOLDER }} # Subfolder name to deploy docs into
keep_files: false # Clear previous docs in destination subfolder to avoid orphaned files

- name: Create root redirect to latest
run: |
git remote set-url origin https://git:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git
yarn storybook:build
yarn storybook:deploy
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
mkdir -p /tmp/root
cat > /tmp/root/index.html << 'REDIRECT'
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="refresh" content="0;url=latest/">
<link rel="canonical" href="latest/">
</head>
<body>
<p>Redirecting to <a href="latest/">latest documentation</a>...</p>
</body>
</html>
REDIRECT

- name: Deploy root redirect
uses: peaceiris/actions-gh-pages@47f197a2200bb9de68ba5f48fad1c088eb1c4a32 # v4.0.0
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: /tmp/root
keep_files: true
1 change: 1 addition & 0 deletions .storybook/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ const config: StorybookConfig = {

return mergeConfig(config, {
// Add dependencies to pre-optimization
base: './',
build: {
chunkSizeWarningLimit: 1000,
minify: false
Expand Down
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@
"storybook:serve": "storybook dev -p 9001",
"storybook:build": "storybook build --docs",
"storybook:build:base": "storybook build",
"storybook:deploy": "npx gh-pages -d storybook-static -m 'chore: update documentation [ci skip]' --nojekyll",
"version": "conventional-changelog -p angular -i CHANGELOG.md -s && node scripts/wait-confirm && git add CHANGELOG.md",
"postversion": "echo \"You can now publish your version using 'git push --follow-tags'\""
},
Expand Down
Loading