-
Notifications
You must be signed in to change notification settings - Fork 0
103 lines (90 loc) · 2.71 KB
/
__deploy.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
name: Deploy 🏗️
on:
workflow_call:
inputs:
branch:
required: true
type: string
commit:
required: false
type: string
comment:
required: false
type: boolean
artifact_name:
required: false
type: string
default: page
is_prerelease:
required: true
type: boolean
# Allow this job to clone the repo and create a page deployment
permissions:
contents: read
pages: write
id-token: write
env:
CF_PROJECT_NAME: bpm2025seville
jobs:
cf-pages:
name: Cloudflare Pages 📃
runs-on: ubuntu-latest
environment:
name: ${{ inputs.branch == 'main' && 'Production (Cloudflare Pages)' || 'Preview (Cloudflare Pages)' }}
url: ${{ steps.cf.outputs.deployment-url }}
outputs:
url: ${{ steps.cf.outputs.deployment-url }}
steps:
- name: Download workflow artifact ⬇️
uses: actions/[email protected]
with:
name: ${{ inputs.artifact_name }}
path: dist
- name: Publish to Cloudflare Pages 📃
uses: cloudflare/[email protected]
id: cf
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
command: pages deploy dist --project-name=${{ env.CF_PROJECT_NAME }} --branch=${{ inputs.branch }}
github-pages:
name: GitHub Pages 📃
runs-on: ubuntu-latest
if: ${{ !inputs.is_prerelease }}
environment:
name: ${{ inputs.branch == 'main' && 'Production (GitHub Pages)' || 'Preview (GitHub Pages)' }}
url: ${{ steps.deploy.outputs.page_url }}
steps:
- name: Download workflow artifact ⬇️
uses: actions/[email protected]
with:
name: ${{ inputs.artifact_name }}
path: dist
- name: Upload GitHub Pages artifact ⬆️
uses: actions/[email protected]
with:
path: dist
- name: Deploy to GitHub Pages 🚀
id: deploy
uses: actions/[email protected]
- name: Remove unnecessary artifacts 🗑️
if: ${{ always() }}
uses: geekyeggo/[email protected]
with:
name: github-pages
compose-comment:
name: Compose and push comment 📝
# Always run so the comment is composed for the workflow summary
if: ${{ always() }}
uses: ./.github/workflows/__job_messages.yml
secrets: inherit
permissions:
pull-requests: write
needs:
- cf-pages
with:
branch: ${{ inputs.branch }}
commit: ${{ inputs.commit }}
preview_url: ${{ needs.cf-pages.outputs.url }}
in_progress: false
comment: ${{ inputs.comment }}