bump #163
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: Deploy to Plash | |
| on: | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| types: [opened, synchronize, reopened] | |
| pull_request_target: | |
| types: [closed] | |
| workflow_dispatch: | |
| jobs: | |
| Docs: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Mask PLASH_CONFIG | |
| run: echo "::add-mask::${{ secrets.PLASH_CONFIG }}" | |
| - name: Create Plash config | |
| run: | | |
| mkdir -p ~/.config | |
| echo '${{ secrets.PLASH_CONFIG }}' > ~/.config/plash_config.json | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.13' | |
| - name: Install plash-cli with pip | |
| run: pip install -e .['dev'] | |
| - name: Deploy PR Preview | |
| if: github.event_name == 'pull_request' && (github.event.pull_request.head.repo.full_name == github.repository || contains(github.event.pull_request.labels.*.name, 'preview-docs')) | |
| run: bash ./scripts/deploy_docs.sh "plash-docs-pr-${{ github.event.pull_request.number }}" | |
| - name: Comment PR with preview URL | |
| if: github.event_name == 'pull_request' && (github.event.pull_request.head.repo.full_name == github.repository || contains(github.event.pull_request.labels.*.name, 'preview-docs')) | |
| uses: actions/github-script@v7 | |
| with: | |
| script: | | |
| const comments = await github.rest.issues.listComments({ | |
| issue_number: context.issue.number, | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| }); | |
| const hasPreviewComment = comments.data.some(comment => | |
| comment.user.login === 'github-actions[bot]' && | |
| comment.body.includes('📖 **Documentation Preview**') | |
| ); | |
| if (!hasPreviewComment) { | |
| await github.rest.issues.createComment({ | |
| issue_number: context.issue.number, | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| body: '📖 **Documentation Preview**: https://plash-docs-pr-${{ github.event.pull_request.number }}.pla.sh' | |
| }); | |
| } | |
| - name: Delete PR Preview | |
| if: github.event_name == 'pull_request_target' && github.event.action == 'closed' | |
| run: plash_delete --force --name "plash-docs-pr-${{ github.event.pull_request.number }}" | |
| - name: Deploy Plash Docs | |
| if: github.event_name == 'push' && github.ref == 'refs/heads/main' || github.event_name == 'workflow_dispatch' | |
| run: bash ./scripts/deploy_docs.sh |