feat: force ssl on firewall #573
This file contains 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: Publish SSG Frontends to Cloudflare Pages | |
on: | |
push: | |
pull_request: | |
workflow_dispatch: | |
inputs: | |
force_deploy: | |
description: 'Force deploy specific project' | |
required: false | |
default: '' | |
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@v3.0.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: Expose git commit data | |
uses: rlespinasse/git-commit-data-action@v1.5.0 | |
# =================== | |
# DASHBOARD | |
# =================== | |
- name: DASHBOARD - Force Deploy Check | |
id: force-deploy-dashboard | |
run: echo "::set-output name=force::${{ github.event.inputs.force_deploy == 'dashboard' }}" | |
- name: DASHBOARD - Get changed dashboard files | |
id: changed-dashboard-files | |
uses: tj-actions/changed-files@v40.1.0 | |
with: | |
files: | | |
frontends/dashboard/** | |
- name: DASHBOARD - Publish to Cloudflare Pages | |
uses: cloudflare/pages-action@v1.5.0 | |
if: steps.changed-dashboard-files.outputs.any_changed == 'true' || steps.force-deploy-dashboard.outputs.force == '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: DASHBOARD - Discord feature branch notification | |
if: github.ref_name != 'master' && (steps.changed-dashboard-files.outputs.any_changed == 'true' || steps.force-deploy-dashboard.outputs.force == '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: DASHBOARD - Discord live branch notification | |
if: github.ref_name == 'master' && (steps.changed-dashboard-files.outputs.any_changed == 'true' || steps.force-deploy-dashboard.outputs.force == '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 }}`' | |
# =================== | |
# LANDER | |
# =================== | |
- name: LANDER - Force Deploy Check | |
id: force-deploy-lander | |
run: echo "::set-output name=force::${{ github.event.inputs.force_deploy == 'lander' }}" | |
- name: LANDER - Get changed files | |
id: changed-lander-files | |
uses: tj-actions/changed-files@v40.1.0 | |
with: | |
files: | | |
frontends/lander/** | |
- name: LANDER - Publish to Cloudflare Pages | |
uses: cloudflare/pages-action@v1.5.0 | |
if: steps.changed-lander-files.outputs.any_changed == 'true' || steps.force-deploy-lander.outputs.force == 'true' | |
id: lander_deploy | |
with: | |
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} | |
gitHubToken: ${{ secrets.GITHUB_TOKEN }} | |
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} | |
projectName: pockethost-lander | |
directory: ./dist/lander | |
branch: ${{ github.head_ref || github.ref_name }} | |
wranglerVersion: '3' | |
- name: LANDER - Discord feature branch notification | |
if: github.ref_name != 'master' && (steps.changed-lander-files.outputs.any_changed == 'true' || steps.force-deploy-lander.outputs.force == '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: LANDER - Discord live branch notification | |
if: github.ref_name == 'master' && (steps.changed-lander-files.outputs.any_changed == 'true' || steps.force-deploy-lander.outputs.force == '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 }}`' | |
# =================== | |
# SUPERADMIN | |
# =================== | |
- name: LANDER - Force Deploy Check | |
id: force-deploy-superadmin | |
run: echo "::set-output name=force::${{ github.event.inputs.force_deploy == 'superadmin' }}" | |
- name: SUPERADMIN - Get changed files | |
id: changed-superadmin-files | |
uses: tj-actions/changed-files@v40.1.0 | |
with: | |
files: | | |
frontends/superadmin/** | |
- name: SUPERADMIN - Publish to Cloudflare Pages | |
uses: cloudflare/pages-action@v1.5.0 | |
if: steps.changed-superadmin-files.outputs.any_changed == 'true' || steps.force-deploy-superadmin.outputs.force == 'true' | |
id: superadmin_deploy | |
with: | |
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} | |
gitHubToken: ${{ secrets.GITHUB_TOKEN }} | |
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} | |
projectName: pockethost-superadmin | |
directory: ./dist/superadmin | |
branch: ${{ github.head_ref || github.ref_name }} | |
wranglerVersion: '3' | |
- name: SUPERADMIN - Discord feature branch notification | |
if: github.ref_name != 'master' && (steps.changed-superadmin-files.outputs.any_changed == 'true' || steps.force-deploy-superadmin.outputs.force == 'true') | |
env: | |
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }} | |
uses: Ilshidur/action-discord@master | |
with: | |
args: '**SUPERADMIN PREVIEW** ${{ steps.superadmin_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: SUPERADMIN - Discord live branch notification | |
if: github.ref_name == 'master' && (steps.changed-superadmin-files.outputs.any_changed == 'true' || steps.force-deploy-superadmin.outputs.force == 'true') | |
env: | |
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }} | |
uses: Ilshidur/action-discord@master | |
with: | |
args: '**SUPERADMIN LIVE** https://superadmin.pockethost.io ([permalink](${{ steps.superadmin_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 }}`' |