-
Notifications
You must be signed in to change notification settings - Fork 13
68 lines (63 loc) · 1.89 KB
/
Copy pathdeploy.yml
File metadata and controls
68 lines (63 loc) · 1.89 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
name: build & deploy
on:
push:
branches: [source]
pull_request:
workflow_dispatch:
permissions:
contents: read
# Let a running deploy finish rather than cancelling it half way.
concurrency:
group: deploy
cancel-in-progress: false
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: actions/setup-node@v7
with:
node-version-file: .node-version
cache: npm
- run: npm ci
- run: npm run build
# Uploaded on pull requests too, so the built site can be downloaded
# from the run page for review.
- uses: actions/upload-artifact@v7
with:
name: site
path: build
# nodejs.jp is served by Netlify out of the master branch, so publishing
# means committing the build output there. This mirrors the update.sh that
# CircleCI used to run.
deploy:
needs: build
if: github.event_name != 'pull_request'
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v7
- uses: actions/setup-node@v7
with:
node-version-file: .node-version
cache: npm
- run: npm ci
- name: Check out master as the build destination
run: |
git clone --depth 1 -b master \
"https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git" \
build
- run: npm run build
- name: Commit and push
working-directory: build
run: |
git config user.name 'github-actions[bot]'
git config user.email '41898282+github-actions[bot]@users.noreply.github.com'
git add -A
if git diff --cached --quiet; then
echo 'nothing to publish'
exit 0
fi
git commit -m 'chore(site): automated update from github actions'
git push origin HEAD:master