@@ -3,15 +3,14 @@ name: Deploy site
3
3
on :
4
4
# Runs on pushes targeting the default branch
5
5
push :
6
- branches : ['main ']
6
+ branches : ['ci-test ']
7
7
8
8
# Allows you to run this workflow manually from the Actions tab
9
9
workflow_dispatch :
10
10
11
11
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
12
12
permissions :
13
- contents : read
14
- pages : write
13
+ contents : write
15
14
id-token : write
16
15
17
16
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
@@ -26,38 +25,42 @@ defaults:
26
25
shell : bash
27
26
28
27
jobs :
29
- # Build job
30
- build :
28
+ deploy :
31
29
runs-on : ubuntu-latest
30
+ env :
31
+ DEPLOY_DIR : _site/
32
+ DEPLOY_BRANCH : gh-pages
32
33
steps :
33
34
- name : Checkout
34
35
uses : actions/checkout@v3
35
36
with :
36
37
submodules : recursive
37
- - name : Setup Pages
38
- id : pages
39
- uses : actions/configure-pages@v3
38
+
39
+ - name : Prepare deployment branch
40
+ run : |
41
+ mkdir "${DEPLOY_DIR}"
42
+ cd "${DEPLOY_DIR}"
43
+ # Clone and checkout existing branch, or initialise with a new and empty branch
44
+ git clone --depth 5 --branch "${DEPLOY_BRANCH}" "https://github.com/${GITHUB_REPOSITORY}.git" . || git init -b "${DEPLOY_BRANCH}"
45
+
40
46
- name : Install Node.js dependencies
41
47
run : npm ci
48
+
42
49
- name : Build with Eleventy
43
50
env :
44
- NODE_ENV : production
51
+ NODE_ENV : development
45
52
NODE_OPTIONS : ' --max_old_space_size=4096'
46
- run : npm run build -- --pathprefix="${{ steps.pages.outputs.base_path }}/"
47
- # run: npm run build -- --pathprefix="/bugs.jqueryui.com/"
48
- - name : Upload artifact
49
- uses : actions/upload-pages-artifact@v1
50
- with :
51
- path : ./_site
53
+ run : npm run build -- --pathprefix="/bugs.jqueryui.com/"
52
54
53
- # Deployment job
54
- deploy :
55
- environment :
56
- name : github-pages
57
- url : ${{ steps.deployment.outputs.page_url }}
58
- runs-on : ubuntu-latest
59
- needs : build
60
- steps :
61
- - name : Deploy to GitHub Pages
62
- id : deployment
63
- uses : actions/deploy-pages@v2
55
+ - name : Push to branch
56
+ # Inspired by https://github.com/helaili/jekyll-action/blob/2.2.0/entrypoint.sh
57
+ env :
58
+ GITHUB_TOKEN : ' ${{ secrets.GITHUB_TOKEN }}'
59
+ run : |
60
+ cd "${DEPLOY_DIR}"
61
+ touch .nojekyll
62
+ git config user.name "${GITHUB_ACTOR}" && \
63
+ git config user.email "${GITHUB_ACTOR}@users.noreply.github.com" && \
64
+ git add . && \
65
+ git commit --allow-empty -m "Build commit ${GITHUB_SHA}" && \
66
+ git push "https://${GITHUB_ACTOR}:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git" "HEAD:${DEPLOY_BRANCH}"
0 commit comments