@@ -3,15 +3,14 @@ name: Deploy site
33on :
44 # Runs on pushes targeting the default branch
55 push :
6- branches : ['main ']
6+ branches : ['ci-test ']
77
88 # Allows you to run this workflow manually from the Actions tab
99 workflow_dispatch :
1010
1111# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
1212permissions :
13- contents : read
14- pages : write
13+ contents : write
1514 id-token : write
1615
1716# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
@@ -26,38 +25,42 @@ defaults:
2625 shell : bash
2726
2827jobs :
29- # Build job
30- build :
28+ deploy :
3129 runs-on : ubuntu-latest
30+ env :
31+ DEPLOY_DIR : _site/
32+ DEPLOY_BRANCH : gh-pages
3233 steps :
3334 - name : Checkout
3435 uses : actions/checkout@v3
3536 with :
3637 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+
4046 - name : Install Node.js dependencies
4147 run : npm ci
48+
4249 - name : Build with Eleventy
4350 env :
44- NODE_ENV : production
51+ NODE_ENV : development
4552 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/"
5254
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