build: added trusted publishing #58
This file contains hidden or 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: Docs | |
| env: | |
| USE_LOCKFILE: ${{ secrets.USE_LOCKFILE }} | |
| ENABLE_DOCS: ${{ secrets.ENABLE_DOCS }} | |
| on: | |
| push: | |
| branches: [ master ] | |
| repository_dispatch: | |
| types: [ docs ] | |
| jobs: | |
| docs: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| node-version: ["lts/*"] | |
| steps: | |
| - uses: actions/checkout@v6 | |
| if: "env.ENABLE_DOCS == 'true'" | |
| - name: Setup | |
| uses: ./.github/actions/composite-setup | |
| if: "env.ENABLE_DOCS == 'true'" | |
| with: | |
| USE_LOCKFILE: ${{ env.USE_LOCKFILE }} | |
| - name: Install Playwright Browsers | |
| run: npx playwright install --with-deps | |
| - name: Build | |
| uses: ./.github/actions/composite-build | |
| if: "env.ENABLE_DOCS == 'true'" | |
| with: | |
| USE_LOCKFILE: ${{ env.USE_LOCKFILE }} | |
| - run: pnpm doc | |
| if: "env.ENABLE_DOCS == 'true'" | |
| - name: Build and Copy Demos/Playgrounds if They Exist | |
| if: "env.ENABLE_DOCS == 'true'" | |
| # we don't need to build the playground as normally the full build script should do it | |
| run: | | |
| if [ -d "playground" ]; then | |
| cp -r playground/.output/public docs/demo | |
| fi | |
| if [ -d "demo" ]; then | |
| pushcd demo && pnpm i --frozen-lockfile | |
| popd | |
| cp -r demo/dist docs/demo | |
| fi | |
| - name: Documentation | |
| uses: crazy-max/ghaction-github-pages@v4 | |
| if: "env.ENABLE_DOCS == 'true'" | |
| with: | |
| jekyll: false | |
| target_branch: gh-pages | |
| build_dir: docs | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |