diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 22c8d7ce..abf2e744 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -123,7 +123,7 @@ jobs: docs: runs-on: ubuntu-latest needs: [ "build", "release" ] - if: ${{ github.ref == 'refs/heads/master' }} + if: ${{ github.ref == 'refs/heads/master' || github.ref == 'refs/heads/dev' }} steps: - uses: actions/checkout@v3 - uses: actions/setup-node@v3 @@ -135,6 +135,18 @@ jobs: **/node_modules key: ${{ runner.os }}-${{ hashFiles('**/package-lock.json') }} - run: npm ci - - run: npm run deploy-storybook -- --ci --host-token-env-variable=GITHUB_TOKEN - env: - GITHUB_TOKEN: JulianWielga:${{ secrets.GITHUB_TOKEN }} + - run: | + VERSION=$(npm pkg get version | tr -d '"') + echo "version=$VERSION" >> $GITHUB_ENV + - run: npm run build-storybook -- -o docs + - uses: peaceiris/actions-gh-pages@v4 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: ./docs + destination_dir: v${{ env.version }} + - uses: peaceiris/actions-gh-pages@v4 + if: ${{ github.ref == 'refs/heads/master' }} + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: ./docs + destination_dir: latest diff --git a/src/demo.tsx b/src/demo.tsx index e6cfa79b..29d08a9a 100644 --- a/src/demo.tsx +++ b/src/demo.tsx @@ -1,9 +1,21 @@ import React from "react"; +import { name, version } from "../package.json"; import { ContentGetter } from "./demo/contentGetter"; import { DebugButtons } from "./demo/DebugButtons"; import { DemoWindowKind } from "./demo/DemoWindowKind"; import { WindowManagerProvider } from "./index"; +const Header: React.FC = () => { + if (window["Cypress"]) return null; + + return ( +
+

{name}

+

v{version}

+
+ ); +}; + const Demo: React.FC = () => { return ( @@ -14,6 +26,7 @@ const Demo: React.FC = () => { }, }} > +
); diff --git a/tsconfig.json b/tsconfig.json index 5e11c216..e307596f 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -13,7 +13,8 @@ "jsx": "react", "moduleResolution": "node", "allowSyntheticDefaultImports": true, - "esModuleInterop": true + "esModuleInterop": true, + "resolveJsonModule": true }, "include": [ "src/**/*",