Skip to content

Commit 424a921

Browse files
committed
Add conditional execution for site build and deploy steps
Only run 'Build site' and 'Publish' steps when on master branch to avoid unnecessary builds and deployments on pull requests.
1 parent 0c5fe69 commit 424a921

File tree

2 files changed

+16
-41
lines changed

2 files changed

+16
-41
lines changed

.github/workflows/build-html.yml renamed to .github/workflows/build-html-and-deploy-pages.yml

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Build HTML from Sample CV
1+
name: Build HTML and Deploy to CF Pages
22

33
on:
44
push:
@@ -36,4 +36,18 @@ jobs:
3636
with:
3737
name: sample-cv-html
3838
path: output/index.html
39-
retention-days: 30
39+
retention-days: 30
40+
41+
- name: Build site
42+
if: github.ref == 'refs/heads/master'
43+
run: npm run build-site
44+
45+
- name: Publish
46+
if: github.ref == 'refs/heads/master'
47+
uses: cloudflare/pages-action@v1
48+
with:
49+
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
50+
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
51+
projectName: jsoncv
52+
directory: src/dist
53+
branch: master

.github/workflows/cf-pages.yml

Lines changed: 0 additions & 39 deletions
This file was deleted.

0 commit comments

Comments
 (0)