Skip to content

Commit 76c74d1

Browse files
committed
ci: publish to master instead of GitHub Pages
nodejs.jp turns out to be served by Netlify out of the master branch, not by GitHub Pages, so deploying through the Pages API would not touch the live site. Replace the Pages deploy job with one that builds into a checkout of master and pushes, which is what update.sh did under CircleCI.
1 parent 992f5e6 commit 76c74d1

2 files changed

Lines changed: 33 additions & 10 deletions

File tree

.github/workflows/deploy.yml

Lines changed: 31 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ permissions:
1111

1212
# Let a running deploy finish rather than cancelling it half way.
1313
concurrency:
14-
group: pages
14+
group: deploy
1515
cancel-in-progress: false
1616

1717
jobs:
@@ -27,20 +27,42 @@ jobs:
2727
- run: npm run build
2828
# Uploaded on pull requests too, so the built site can be downloaded
2929
# from the run page for review.
30-
- uses: actions/upload-pages-artifact@v5
30+
- uses: actions/upload-artifact@v7
3131
with:
32+
name: site
3233
path: build
3334

35+
# nodejs.jp is served by Netlify out of the master branch, so publishing
36+
# means committing the build output there. This mirrors the update.sh that
37+
# CircleCI used to run.
3438
deploy:
3539
needs: build
3640
if: github.event_name != 'pull_request'
3741
runs-on: ubuntu-latest
3842
permissions:
39-
pages: write
40-
id-token: write
41-
environment:
42-
name: github-pages
43-
url: ${{ steps.deployment.outputs.page_url }}
43+
contents: write
4444
steps:
45-
- id: deployment
46-
uses: actions/deploy-pages@v5
45+
- uses: actions/checkout@v7
46+
- uses: actions/setup-node@v7
47+
with:
48+
node-version-file: .node-version
49+
cache: npm
50+
- run: npm ci
51+
- name: Check out master as the build destination
52+
run: |
53+
git clone --depth 1 -b master \
54+
"https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git" \
55+
build
56+
- run: npm run build
57+
- name: Commit and push
58+
working-directory: build
59+
run: |
60+
git config user.name 'github-actions[bot]'
61+
git config user.email '41898282+github-actions[bot]@users.noreply.github.com'
62+
git add -A
63+
if git diff --cached --quiet; then
64+
echo 'nothing to publish'
65+
exit 0
66+
fi
67+
git commit -m 'chore(site): automated update from github actions'
68+
git push origin HEAD:master

bulbofile.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,5 +131,6 @@ asset('source/pdfs/**/*.pdf')
131131
// Old site is available under http://nodejs.jp/old/
132132
asset('./old/*.*').base('./')
133133

134-
// The custom domain needs to be part of the published artifact
134+
// Keep CNAME in the published output rather than relying on the copy that
135+
// happens to sit in master
135136
asset('./CNAME').base('./')

0 commit comments

Comments
 (0)