on: [push] jobs: publish: runs-on: ubuntu-latest permissions: contents: read deployments: write name: Publish to Cloudflare Pages steps: - name: Checkout uses: actions/checkout@v4.1.1 - name: pnpm uses: pnpm/action-setup@v2.4.0 - name: Use Node.js ${{ matrix.node-version }} uses: actions/setup-node@v4 with: node-version: 20.x cache: 'pnpm' - name: Prepare build run: | pnpm i pnpm lint pnpm build-frontends ls ls dist - name: Get changed lander files id: changed-lander-files uses: tj-actions/changed-files@v40.1.0 with: files: | frontends/lander/** - name: Get changed dashboard files id: changed-dashboard-files uses: tj-actions/changed-files@v40.1.0 with: files: | frontends/dashboard/** - name: Publish lander to Cloudflare Pages uses: cloudflare/pages-action@v1.5.0 if: steps.changed-lander-files.outputs.any_changed == 'true' id: lander_deploy with: apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} gitHubToken: ${{ secrets.GITHUB_TOKEN }} accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} projectName: pockethost directory: ./dist/lander branch: ${{ github.head_ref || github.ref_name }} wranglerVersion: '3' - name: Publish dashboard to Cloudflare Pages uses: cloudflare/pages-action@v1.5.0 if: steps.changed-dashboard-files.outputs.any_changed == 'true' id: dashboard_deploy with: apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} gitHubToken: ${{ secrets.GITHUB_TOKEN }} accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} projectName: pockethost-dashboard directory: ./dist/dashboard branch: ${{ github.head_ref || github.ref_name }} wranglerVersion: '3' - name: Expose git commit data uses: rlespinasse/git-commit-data-action@v1.5.0 - name: Discord feature branch notification for dashboard if: github.ref_name != 'master' && steps.changed-dashboard-files.outputs.any_changed == 'true' env: DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }} uses: Ilshidur/action-discord@master with: args: '**DASHBOARD PREVIEW** ${{ steps.dashboard_deploy.outputs.url }} was generated by ${{ github.actor }} in [${{ env.GIT_COMMIT_SHORT_SHA }}](https://github.com/${{ github.repository}}/commit/${{ github.sha }}) on [${{ github.repository}}#${{ github.ref_name }}](https://github.com/${{ github.repository}}/tree/${{ github.ref_name }}) with memo `${{ env.GIT_COMMIT_MESSAGE_SUBJECT }}`' - name: Discord feature branch notification for lander if: github.ref_name != 'master' && steps.changed-lander-files.outputs.any_changed == 'true' env: DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }} uses: Ilshidur/action-discord@master with: args: '**LANDER PREVIEW** ${{ steps.lander_deploy.outputs.url }} was generated by ${{ github.actor }} in [${{ env.GIT_COMMIT_SHORT_SHA }}](https://github.com/${{ github.repository}}/commit/${{ github.sha }}) on [${{ github.repository}}#${{ github.ref_name }}](https://github.com/${{ github.repository}}/tree/${{ github.ref_name }}) with memo `${{ env.GIT_COMMIT_MESSAGE_SUBJECT }}`' - name: Discord live branch notification for dashboard if: github.ref_name == 'master' && steps.changed-dashboard-files.outputs.any_changed == 'true' env: DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }} uses: Ilshidur/action-discord@master with: args: '**DASHBOARD LIVE** https://app.pockethost.io ([permalink](${{ steps.dashboard_deploy.outputs.url }})) was updated by ${{ github.actor }} in [${{ env.GIT_COMMIT_SHORT_SHA }}](https://github.com/${{ github.repository}}/commit/${{ github.sha }}) on [${{ github.repository}}#${{ github.ref_name }}](https://github.com/${{ github.repository}}/tree/${{ github.ref_name }}): `${{ env.GIT_COMMIT_MESSAGE_SUBJECT }}`' - name: Discord live branch notification for lander if: github.ref_name == 'master' && steps.changed-lander-files.outputs.any_changed == 'true' env: DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }} uses: Ilshidur/action-discord@master with: args: '**LANDER LIVE** https://pockethost.io ([permalink](${{ steps.lander_deploy.outputs.url }})) was updated by ${{ github.actor }} in [${{ env.GIT_COMMIT_SHORT_SHA }}](https://github.com/${{ github.repository}}/commit/${{ github.sha }}) on [${{ github.repository}}#${{ github.ref_name }}](https://github.com/${{ github.repository}}/tree/${{ github.ref_name }}): `${{ env.GIT_COMMIT_MESSAGE_SUBJECT }}`'