Skip to content

Commit 0188b83

Browse files
authored
Trigger build on release creation (#40)
* feat(workflows/release): only create release when run * docs(workflows/deploy): comments * fix(workflows/deploy): build on release created
1 parent acc7251 commit 0188b83

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

.github/workflows/deploy.yml

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
# 🧠 Thought process:
2+
# This workflow builds and deploys the website and CV.
3+
# - On push to main: build only, no deploy
4+
# - On release tag: build (if artifact is not present) and deploy both
5+
# - Using composite action to avoid code duplication
16
name: Build and Deploy
27

38
on:
@@ -15,7 +20,10 @@ permissions:
1520

1621
jobs:
1722
build-web:
18-
if: github.event_name == 'push' && startsWith(github.ref, 'refs/heads/main') || github.event_name == 'workflow_dispatch'
23+
if: >
24+
(github.event_name == 'release' && github.event.action == 'created' ) ||
25+
(github.event_name == 'push' && startsWith(github.ref, 'refs/heads/main')) ||
26+
(github.event_name == 'workflow_dispatch')
1927
runs-on: ubuntu-latest
2028
outputs:
2129
neovim-lines: ${{ steps.lines.outputs.count }}
@@ -52,8 +60,11 @@ jobs:
5260
path: ./dist/
5361

5462
build-cv:
55-
if: github.event_name == 'push' && startsWith(github.ref, 'refs/heads/main') || github.event_name == 'workflow_dispatch'
56-
needs: build-web
63+
if: >
64+
(github.event_name == 'release' && github.event.action == 'created' ) ||
65+
(github.event_name == 'push' && startsWith(github.ref, 'refs/heads/main')) ||
66+
(github.event_name == 'workflow_dispatch')
67+
needs: build-web # leverage pnpm cache reuse
5768
runs-on: ubuntu-latest
5869
env:
5970
GITHUB_RUN_NUMBER: ${{ github.run_number }}

0 commit comments

Comments
 (0)