Skip to content

Commit ab883dd

Browse files
authored
ci: update deploy workflow (#64)
* display version tag in cloudflare UI * print deployment URLs * add commit hash, commit-dirty flag
1 parent 439cc16 commit ab883dd

File tree

1 file changed

+52
-6
lines changed

1 file changed

+52
-6
lines changed

.github/workflows/deploy.yml

Lines changed: 52 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -99,29 +99,52 @@ jobs:
9999
# PREVIEW branch
100100
- name: Deploy ${{ github.ref_name }} to PREVIEW branch of ${{ env.PROJECT_NAME }} project
101101
if: github.event_name == 'push'
102+
id: deploy-preview
102103
uses: cloudflare/wrangler-action@da0e0dfe58b7a431659754fdf3f186c529afbe65 # v3.14.1
103104
with:
104105
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
105106
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
106-
command: pages deploy dist --project-name=${{ env.PROJECT_NAME }} --branch=preview
107+
command: pages deploy dist --project-name=${{ env.PROJECT_NAME }} --branch=preview --commit-message="LATEST PREVIEW ${{ github.ref_name }}" --commit-hash=${{ github.sha }} --commit-dirty=true
107108

108109
# VERSION branch
109110
- name: Deploy ${{ github.ref_name }} to VERSION branch ${{ github.ref_name }} of ${{ env.PROJECT_NAME }} project
111+
id: deploy-version
110112
if: github.event_name == 'push'
111113
uses: cloudflare/wrangler-action@da0e0dfe58b7a431659754fdf3f186c529afbe65 # v3.14.1
112114
with:
113115
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
114116
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
115-
command: pages deploy dist --project-name=${{ env.PROJECT_NAME }} --branch=${{ github.ref_name }}
117+
command: pages deploy dist --project-name=${{ env.PROJECT_NAME }} --branch=${{ github.ref_name }} --commit-message="VERSION ${{ github.ref_name }}" --commit-hash=${{ github.sha }} --commit-dirty=true
116118

117119
# PRODUCTION branch
118120
- name: Deploy ${{ github.ref_name }} to PRODUCTION of ${{ env.PROJECT_NAME }} project
121+
id: deploy-production
119122
if: github.event_name == 'workflow_dispatch'
120123
uses: cloudflare/wrangler-action@da0e0dfe58b7a431659754fdf3f186c529afbe65 # v3.14.1
121124
with:
122125
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
123126
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
124-
command: pages deploy dist --project-name=${{ env.PROJECT_NAME }} --branch=master
127+
command: pages deploy dist --project-name=${{ env.PROJECT_NAME }} --branch=master --commit-message="${{ github.ref_name }}" --commit-hash=${{ github.sha }} --commit-dirty=true
128+
129+
# print deployment URLs
130+
131+
- name: print PREVIEW deployment-url
132+
if: steps.deploy-preview.outputs.deployment-url
133+
env:
134+
DEPLOYMENT_URL_PREVIEW: ${{ steps.deploy-preview.outputs.deployment-url }}
135+
run: echo $DEPLOYMENT_URL_PREVIEW
136+
137+
- name: print VERSION deployment-url
138+
if: steps.deploy-version.outputs.deployment-url
139+
env:
140+
DEPLOYMENT_URL_VERSION: ${{ steps.deploy-version.outputs.deployment-url }}
141+
run: echo $DEPLOYMENT_URL_VERSION
142+
143+
- name: print PRODUCTION deployment-url
144+
if: steps.deploy-production.outputs.deployment-url
145+
env:
146+
DEPLOYMENT_URL_PRODUCTION: ${{ steps.deploy-production.outputs.deployment-url }}
147+
run: echo $DEPLOYMENT_URL_PRODUCTION
125148

126149

127150
######################################################################
@@ -199,26 +222,49 @@ jobs:
199222
# PREVIEW branch
200223
- name: Deploy ${{ github.ref_name }} to PREVIEW branch of ${{ env.PROJECT_NAME }} project
201224
if: github.event_name == 'push'
225+
id: deploy-preview
202226
uses: cloudflare/wrangler-action@da0e0dfe58b7a431659754fdf3f186c529afbe65 # v3.14.1
203227
with:
204228
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
205229
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
206-
command: pages deploy dist --project-name=${{ env.PROJECT_NAME }} --branch=preview
230+
command: pages deploy dist --project-name=${{ env.PROJECT_NAME }} --branch=preview --commit-message="LATEST PREVIEW ${{ github.ref_name }}" --commit-hash=${{ github.sha }} --commit-dirty=true
207231

208232
# VERSION branch
209233
- name: Deploy ${{ github.ref_name }} to VERSION branch ${{ github.ref_name }} of ${{ env.PROJECT_NAME }} project
234+
id: deploy-version
210235
if: github.event_name == 'push'
211236
uses: cloudflare/wrangler-action@da0e0dfe58b7a431659754fdf3f186c529afbe65 # v3.14.1
212237
with:
213238
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
214239
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
215-
command: pages deploy dist --project-name=${{ env.PROJECT_NAME }} --branch=${{ github.ref_name }}
240+
command: pages deploy dist --project-name=${{ env.PROJECT_NAME }} --branch=${{ github.ref_name }} --commit-message="VERSION ${{ github.ref_name }}" --commit-hash=${{ github.sha }} --commit-dirty=true
216241

217242
# PRODUCTION branch
218243
- name: Deploy ${{ github.ref_name }} to PRODUCTION of ${{ env.PROJECT_NAME }} project
244+
id: deploy-production
219245
if: github.event_name == 'workflow_dispatch'
220246
uses: cloudflare/wrangler-action@da0e0dfe58b7a431659754fdf3f186c529afbe65 # v3.14.1
221247
with:
222248
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
223249
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
224-
command: pages deploy dist --project-name=${{ env.PROJECT_NAME }} --branch=master
250+
command: pages deploy dist --project-name=${{ env.PROJECT_NAME }} --branch=master --commit-message="${{ github.ref_name }}" --commit-hash=${{ github.sha }} --commit-dirty=true
251+
252+
# print deployment URLs
253+
254+
- name: print PREVIEW deployment-url
255+
if: steps.deploy-preview.outputs.deployment-url
256+
env:
257+
DEPLOYMENT_URL_PREVIEW: ${{ steps.deploy-preview.outputs.deployment-url }}
258+
run: echo $DEPLOYMENT_URL_PREVIEW
259+
260+
- name: print VERSION deployment-url
261+
if: steps.deploy-version.outputs.deployment-url
262+
env:
263+
DEPLOYMENT_URL_VERSION: ${{ steps.deploy-version.outputs.deployment-url }}
264+
run: echo $DEPLOYMENT_URL_VERSION
265+
266+
- name: print PRODUCTION deployment-url
267+
if: steps.deploy-production.outputs.deployment-url
268+
env:
269+
DEPLOYMENT_URL_PRODUCTION: ${{ steps.deploy-production.outputs.deployment-url }}
270+
run: echo $DEPLOYMENT_URL_PRODUCTION

0 commit comments

Comments
 (0)