fix: deploy preview #1
Workflow file for this run
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: preview.yaml | |
| on: | |
| pull_request: | |
| types: [ opened, synchronize, reopened ] | |
| branches: | |
| - master | |
| concurrency: preview-${{ github.ref }} | |
| jobs: | |
| deploy-preview: | |
| name: "Deploy Preview for PR #${{github.event.pull_request.number}}" | |
| if: github.event_name == 'pull_request' # Only run for pull requests | |
| runs-on: ubuntu-latest | |
| # Grant GITHUB_TOKEN the permissions required to make a Pages deployment | |
| permissions: | |
| pages: write # to deploy to Pages | |
| pull-requests: write | |
| contents: write | |
| id-token: write | |
| env: | |
| DOCASAURUS_BASE_URL: https://chargepi.cc/pr-preview-action/pr-${{github.event.pull_request.number}} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: latest | |
| # cache: yarn | |
| - uses: pnpm/action-setup@v4 | |
| with: | |
| version: 10.11.0 | |
| - name: Install and Build | |
| run: | | |
| pnpm install | |
| pnpm run build | |
| - name: Deploy 🚀 | |
| uses: JamesIves/github-pages-deploy-action@v4 | |
| with: | |
| folder: build # The folder the action should deploy. | |
| target-folder: ${{ github.ref_name }}/build | |
| - name: Deploy preview | |
| uses: rossjrw/pr-preview-action@v1 | |
| with: | |
| source-dir: ${{ github.ref_name }}/build | |
| action: 'auto' | |
| pages-base-url: chargepi.cc |