diff --git a/.dumirc.ts b/.dumirc.ts index d24799e..ff078b3 100644 --- a/.dumirc.ts +++ b/.dumirc.ts @@ -2,6 +2,9 @@ import { defineConfig } from 'dumi'; import path from 'path'; +const basePath = process.env.GITHUB_ACTIONS ? '/collapse/' : '/'; +const publicPath = process.env.GITHUB_ACTIONS ? '/collapse/' : '/'; + export default defineConfig({ alias: { 'rc-collapse$': path.resolve('src'), @@ -14,4 +17,6 @@ export default defineConfig({ }, outputPath: '.doc', exportStatic: {}, + base: basePath, + publicPath, }); diff --git a/.github/workflows/react-component-ci.yml b/.github/workflows/react-component-ci.yml index 432a3fb..5ffd207 100644 --- a/.github/workflows/react-component-ci.yml +++ b/.github/workflows/react-component-ci.yml @@ -46,6 +46,7 @@ jobs: lint: runs-on: ubuntu-latest + needs: setup steps: - name: checkout uses: actions/checkout@master @@ -65,10 +66,10 @@ jobs: - name: lint run: npm run lint - needs: setup compile: runs-on: ubuntu-latest + needs: setup steps: - name: checkout uses: actions/checkout@master @@ -87,11 +88,10 @@ jobs: - name: compile run: npm run compile - - needs: setup coverage: runs-on: ubuntu-latest + needs: setup steps: - name: checkout uses: actions/checkout@master @@ -109,6 +109,4 @@ jobs: key: node_modules-${{ hashFiles('**/package-temp-dir/package-lock.json') }} - name: coverage - run: npm test -- --coverage && bash <(curl -s https://codecov.io/bash) - - needs: setup + run: npm run coverage && bash <(curl -s https://codecov.io/bash) diff --git a/.github/workflows/site-deploy.yml b/.github/workflows/site-deploy.yml new file mode 100644 index 0000000..19eaa7b --- /dev/null +++ b/.github/workflows/site-deploy.yml @@ -0,0 +1,39 @@ +name: Deploy website +on: + push: + tags: + - '*' + workflow_dispatch: + +permissions: + contents: write + +jobs: + build-and-deploy: + runs-on: ubuntu-latest + steps: + - name: checkout + uses: actions/checkout@v3 + + - name: setup node + uses: actions/setup-node@v1 + with: + node-version: 14 + + - name: create package-lock.json + run: npm i --package-lock-only --ignore-scripts + + - name: Install dependencies + run: npm ci + + - name: build Docs + run: npm run build + + - name: Deploy to GitHub Pages + uses: peaceiris/actions-gh-pages@v3 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: ./.doc + force_orphan: true + user_name: 'github-actions[bot]' + user_email: 'github-actions[bot]@users.noreply.github.com'