From 43b716c3029dd021f09e3d0ef2714b771155a483 Mon Sep 17 00:00:00 2001 From: Andy Kenward <4893048+andykenward@users.noreply.github.com> Date: Sun, 5 May 2024 16:39:15 +0000 Subject: [PATCH] docs: workflow templates --- .../workflow-templates/delete.properties.json | 6 ++++ .github/workflow-templates/delete.yml | 27 ++++++++++++++++ .../workflow-templates/deploy.properties.json | 6 ++++ .github/workflow-templates/deploy.yml | 32 +++++++++++++++++++ 4 files changed, 71 insertions(+) create mode 100644 .github/workflow-templates/delete.properties.json create mode 100644 .github/workflow-templates/delete.yml create mode 100644 .github/workflow-templates/deploy.properties.json create mode 100644 .github/workflow-templates/deploy.yml diff --git a/.github/workflow-templates/delete.properties.json b/.github/workflow-templates/delete.properties.json new file mode 100644 index 00000000..e357e833 --- /dev/null +++ b/.github/workflow-templates/delete.properties.json @@ -0,0 +1,6 @@ +{ + "name": "Cloudflare Pages Deploy Deletion Workflow", + "description": "Deploy deletion from Cloudflare Pages using andykenward/github-actions-cloudflare-pages/delete", + "iconName": "octicon trash", + "categories": ["Deployment"] +} diff --git a/.github/workflow-templates/delete.yml b/.github/workflow-templates/delete.yml new file mode 100644 index 00000000..d69acc1a --- /dev/null +++ b/.github/workflow-templates/delete.yml @@ -0,0 +1,27 @@ +# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json + +name: Cloudflare Pages Delete + +on: + pull_request: + types: + - closed + branches: + - $default-branch +jobs: + deploy: + permissions: + actions: read # Only required for private GitHub Repo + contents: read + deployments: write + pull-requests: write + runs-on: ubuntu-latest + timeout-minutes: 5 + steps: + - name: 'Checkout Github Action' + uses: actions/checkout@v4 + - name: 'Deploy deletion from Cloudflare Pages' + uses: andykenward/github-actions-cloudflare-pages/delete@v2 + with: + cloudflare-api-token: ${{ secrets.CLOUDFLARE_API_TOKEN }} + github-token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflow-templates/deploy.properties.json b/.github/workflow-templates/deploy.properties.json new file mode 100644 index 00000000..5401c124 --- /dev/null +++ b/.github/workflow-templates/deploy.properties.json @@ -0,0 +1,6 @@ +{ + "name": "Cloudflare Pages Deploy Workflow", + "description": "Deploy to Cloudflare Pages using andykenward/github-actions-cloudflare-pages", + "iconName": "octicon cloud", + "categories": ["Deployment"] +} diff --git a/.github/workflow-templates/deploy.yml b/.github/workflow-templates/deploy.yml new file mode 100644 index 00000000..1bd14225 --- /dev/null +++ b/.github/workflow-templates/deploy.yml @@ -0,0 +1,32 @@ +# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json + +name: Cloudflare Pages Deploy + +on: + push: + branches: + - $default-branch + pull_request: + branches: + - $default-branch +jobs: + deploy: + permissions: + actions: read # Only required for private GitHub Repo + contents: read + deployments: write + pull-requests: write + runs-on: ubuntu-latest + timeout-minutes: 5 + steps: + - name: 'Checkout Github Action' + uses: actions/checkout@v4 + - name: 'Deploy to Cloudflare Pages' + uses: andykenward/github-actions-cloudflare-pages@v2 + with: + cloudflare-api-token: ${{ secrets.CLOUDFLARE_API_TOKEN }} + cloudflare-account-id: ${{ vars.CLOUDFLARE_ACCOUNT_ID }} + cloudflare-project-name: ${{ vars.CLOUDFLARE_PROJECT_NAME }} + directory: dist + github-token: ${{ secrets.GITHUB_TOKEN }} + github-environment: ${{ (github.ref == 'refs/heads/main' && 'production') || 'preview' }}