Fix router bug #46
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: [push] | |
jobs: | |
ci: | |
runs-on: ubuntu-latest | |
permissions: | |
pages: write | |
id-token: write | |
steps: | |
- uses: pnpm/action-setup@v4 | |
with: | |
version: 8 | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 2 | |
- run: pnpm install | |
- run: pnpm lint | |
- run: pnpm format:check | |
- run: pnpm test | |
working-directory: packages/zod-error-viewer | |
- run: pnpm build | |
working-directory: packages/zod-error-viewer | |
- name: Publish package | |
working-directory: packages/zod-error-viewer | |
run: | | |
if [ $GITHUB_REF != "refs/heads/main" ]; then | |
echo "Branch is not main, skipping publish step" | |
exit 0 | |
fi | |
echo "Branch is main, proceeding..." | |
prev_version=$(git show HEAD~1:packages/zod-error-viewer/package.json | jq -r '.version') | |
new_version=$(cat package.json | jq -r '.version') | |
if [ $prev_version = $new_version ]; then | |
echo "Version has not changed, skipping publish step" | |
exit 0 | |
fi | |
echo "Version was changed from ${prev_version} to ${new_version}, proceeding with publish step..." | |
echo "Setting auth token..." | |
pnpm config set //registry.npmjs.org/:_authToken ${{ secrets.NPM_TOKEN }} | |
echo "Set auth token" | |
echo "Publishing package..." | |
pnpm publish | |
- name: Build storybook | |
working-directory: packages/zod-error-viewer | |
run: pnpm build-storybook | |
- name: Build docs site | |
working-directory: packages/docs-site | |
run: pnpm build | |
- name: Move storybook to under docs site | |
run: mv ./packages/zod-error-viewer/storybook-static ./packages/docs-site/dist/storybook-static | |
# Workaround since github pages does not support routing all requests to index.html | |
- name: Create fake pages | |
run: | | |
mkdir ./packages/docs-site/dist/docs | |
cp ./packages/docs-site/dist/index.html ./packages/docs-site/dist/docs/index.html | |
mkdir ./packages/docs-site/dist/playground | |
cp ./packages/docs-site/dist/index.html ./packages/docs-site/dist/playground/index.html | |
- name: Upload documentation artifact | |
uses: actions/upload-pages-artifact@v3 | |
with: | |
path: packages/docs-site/dist | |
- name: Publish documentation | |
uses: actions/deploy-pages@v4 |