Files
templates/.github/workflows/deploy-preview.yml
Mauricio Siu 5aa80f8c96 chore: update GitHub Actions workflow permissions and artifact retention
- Added permissions for reading contents, actions, and writing pull requests.
- Set artifact retention period to 1 day for the preview build.
2025-03-16 11:06:50 -06:00

42 lines
1.1 KiB
YAML

name: Upload Preview Deployment
on:
workflow_run:
workflows: ['Build Preview Deployment']
types:
- completed
branches-ignore:
- main
permissions:
actions: read
deployments: write
contents: read
pull-requests: write
jobs:
deploy-preview:
runs-on: ubuntu-latest
if: |
github.event.workflow_run.conclusion == 'success' &&
github.event.workflow_run.event == 'pull_request'
name: Deploy Preview to Cloudflare Pages
steps:
- name: Download artifact
uses: dawidd6/action-download-artifact@v3
with:
workflow: build-preview.yml
name: preview-build
path: build
run_id: ${{ github.event.workflow_run.id }}
if_no_artifact_found: error
- name: Deploy to Cloudflare Pages
uses: AdrianGonz97/refined-cf-pages-action@v1
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
githubToken: ${{ secrets.GITHUB_TOKEN }}
projectName: ${{ secrets.CLOUDFLARE_PROJECT_NAME }}
deploymentName: Preview
directory: build