Merge pull request #5 from unoplat/link-to-main-website #13
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 Blog to Cloudflare Pages | |
| on: | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| branches: | |
| - main | |
| concurrency: | |
| group: blog-deploy-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| deploy: | |
| name: Deploy to Cloudflare Pages | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| deployments: write | |
| pull-requests: write | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Setup pnpm | |
| uses: pnpm/action-setup@v4 | |
| with: | |
| version: 9 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 22 | |
| cache: 'pnpm' | |
| - name: Install dependencies | |
| run: pnpm install | |
| - name: Build | |
| run: pnpm run build | |
| env: | |
| PUBLIC_GISCUS_REPO: unoplat/unoplat-code-confluence | |
| PUBLIC_GISCUS_REPO_ID: R_kgDOLpX7Fw | |
| PUBLIC_GISCUS_CATEGORY: Announcements | |
| PUBLIC_GISCUS_CATEGORY_ID: DIC_kwDOLpX7F84Ce2Lw | |
| PUBLIC_GISCUS_MAPPING: pathname | |
| PUBLIC_GISCUS_STRICT: "0" | |
| PUBLIC_GISCUS_REACTIONS: "1" | |
| PUBLIC_GISCUS_EMIT_METADATA: "0" | |
| PUBLIC_GISCUS_INPUT_POSITION: bottom | |
| PUBLIC_GISCUS_THEME: preferred_color_scheme | |
| PUBLIC_GISCUS_LANG: en | |
| PUBLIC_GISCUS_LOADING: lazy | |
| - name: Deploy to Cloudflare Pages | |
| id: deploy | |
| uses: cloudflare/wrangler-action@v3 | |
| with: | |
| apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} | |
| accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} | |
| command: pages deploy | |
| gitHubToken: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Output Deployment URLs | |
| env: | |
| DEPLOYMENT_URL: ${{ steps.deploy.outputs.deployment-url }} | |
| ALIAS_URL: ${{ steps.deploy.outputs.pages-deployment-alias-url }} | |
| run: | | |
| echo "Deployment URL: $DEPLOYMENT_URL" | |
| echo "Branch Preview URL: $ALIAS_URL" | |
| - name: Comment on PR | |
| if: github.event_name == 'pull_request' | |
| uses: actions/github-script@v7 | |
| env: | |
| DEPLOYMENT_URL: ${{ steps.deploy.outputs.deployment-url }} | |
| ALIAS_URL: ${{ steps.deploy.outputs.pages-deployment-alias-url }} | |
| with: | |
| script: | | |
| github.rest.issues.createComment({ | |
| issue_number: context.issue.number, | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| body: `🚀 **Preview Deployment Ready!**\n\n**Preview URL**: ${process.env.ALIAS_URL || process.env.DEPLOYMENT_URL}\n\n---\n*Deployed via Cloudflare Pages*` | |
| }) |