Skip to content

Commit fbad977

Browse files
committed
ci: decouple deploy from release (deploy on push, like Monete/EventSplit)
1 parent 98ab5b5 commit fbad977

2 files changed

Lines changed: 46 additions & 42 deletions

File tree

.github/workflows/deploy.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: Deploy to GitHub Pages
2+
3+
on:
4+
push:
5+
branches: [main]
6+
workflow_dispatch:
7+
8+
permissions:
9+
contents: read
10+
pages: write
11+
id-token: write
12+
13+
concurrency:
14+
group: pages
15+
cancel-in-progress: false
16+
17+
jobs:
18+
build-and-deploy:
19+
runs-on: ubuntu-latest
20+
environment:
21+
name: github-pages
22+
url: ${{ steps.deploy.outputs.page_url }}
23+
steps:
24+
- uses: actions/checkout@v6
25+
- uses: actions/setup-node@v6
26+
with:
27+
node-version: 20
28+
cache: npm
29+
- run: npm ci
30+
- run: npm run build
31+
- uses: actions/configure-pages@v6
32+
- uses: actions/upload-pages-artifact@v5
33+
with:
34+
path: dist
35+
- id: deploy
36+
uses: actions/deploy-pages@v5
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Release & Deploy
1+
name: Release Please
22

33
on:
44
push:
@@ -9,20 +9,14 @@ permissions:
99
actions: write
1010
contents: write
1111
pull-requests: write
12-
pages: write
13-
id-token: write
1412

1513
concurrency:
1614
group: release-${{ github.ref }}
1715
cancel-in-progress: false
1816

1917
jobs:
2018
release-please:
21-
name: Release Please
2219
runs-on: ubuntu-latest
23-
outputs:
24-
release_created: ${{ steps.release.outputs.release_created }}
25-
tag_name: ${{ steps.release.outputs.tag_name }}
2620
steps:
2721
- id: release
2822
uses: googleapis/release-please-action@v5
@@ -55,38 +49,12 @@ jobs:
5549
gh api -X DELETE "repos/$REPO/git/refs/heads/$BRANCH" 2>/dev/null || true
5650
gh workflow run "$WORKFLOW" -R "$REPO" --ref main
5751
58-
deploy:
59-
name: Deploy to GitHub Pages
60-
needs: release-please
61-
if: needs.release-please.outputs.release_created == 'true'
62-
runs-on: ubuntu-latest
63-
environment:
64-
name: github-pages
65-
url: ${{ steps.deployment.outputs.page_url }}
66-
steps:
67-
- uses: actions/checkout@v6
68-
with:
69-
ref: ${{ needs.release-please.outputs.tag_name }}
70-
71-
- uses: actions/setup-node@v6
72-
with:
73-
node-version: 20
74-
cache: npm
75-
76-
- name: Install dependencies
77-
run: npm ci
78-
79-
- name: Build
80-
run: npm run build
81-
82-
- name: Setup Pages
83-
uses: actions/configure-pages@v6
84-
85-
- name: Upload Pages artifact
86-
uses: actions/upload-pages-artifact@v5
87-
with:
88-
path: dist
89-
90-
- name: Deploy
91-
id: deployment
92-
uses: actions/deploy-pages@v5
52+
# When a release is actually published, redeploy from main so the live
53+
# build carries the bumped version. release-please's own version-bump
54+
# commit is pushed by GITHUB_TOKEN and does NOT trigger the on:push deploy,
55+
# so the site would otherwise stay one release behind.
56+
- if: ${{ steps.release.outputs.release_created }}
57+
env:
58+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
59+
REPO: ${{ github.repository }}
60+
run: gh workflow run deploy.yml -R "$REPO" --ref main

0 commit comments

Comments
 (0)