-
Notifications
You must be signed in to change notification settings - Fork 3
50 lines (46 loc) · 1.5 KB
/
build.yml
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
# Adapted from https://github.com/jekyll/jekyll/blob/master/.github/workflows/docs.yml
name: Build and deploy Jekyll site
on:
push:
branches:
- main
env:
REMOTE_BRANCH: gh-pages
jobs:
deploy_site:
runs-on: 'ubuntu-latest'
env:
BUNDLE_PATH: "vendor/bundle"
BUNDLE_JOBS: 4
BUNDLE_RETRY: 3
steps:
- uses: actions/checkout@v3
- uses: ruby/setup-ruby@v1
with:
bundler-cache: true
- uses: actions/setup-node@v3
with:
node-version: 16
cache: 'yarn'
- run: yarn install --frozen-lockfile
- name: Clone target branch
run: |
REMOTE_REPO="https://${GITHUB_ACTOR}:${{ secrets.GITHUB_TOKEN }}@github.com/${GITHUB_REPOSITORY}.git"
echo "Publishing to ${GITHUB_REPOSITORY} on branch ${REMOTE_BRANCH}"
rm -rf docs/_site/
git clone --depth=1 --branch="${REMOTE_BRANCH}" --single-branch --no-checkout \
"${REMOTE_REPO}" docs/_site/
- name: Build site
run: bin/build
- name: Deploy to GitHub Pages
run: |
SOURCE_COMMIT="$(git log -1 --pretty="%an: %B" "$GITHUB_SHA")"
pushd docs/_site &>/dev/null
: > .nojekyll
git add --all
git -c user.name="${GITHUB_ACTOR}" -c user.email="${GITHUB_ACTOR}@users.noreply.github.com" \
commit --quiet \
--message "Deploy docs from ${GITHUB_SHA}" \
--message "$SOURCE_COMMIT"
git push
popd &>/dev/null