1- # .github/workflows/deploy-pages.yml
2- name : " Deploy Jekyll with GitHub Pages (robust)"
1+ name : " Deploy Jekyll with GitHub Pages (robust & artifact-v4 compatible)"
32
4- # Triggers: push to main/master, manual dispatch, and periodic schedule (UTC)
53on :
64 push :
75 branches :
8- - main
96 - master
7+ - main
108 workflow_dispatch : {}
119 schedule :
12- - cron : ' 0 12 * * *' # daily at 12:00 UTC (adjust if needed)
10+ - cron : ' 0 12 * * *' # daily at 12:00 UTC (adjust as needed)
1311
14- # Least privilege for required tokens
1512permissions :
16- contents : read # read repo contents to build
17- pages : write # allow publishing to GitHub Pages
18- id-token : write # for OIDC if you need it later (optional)
13+ contents : read
14+ pages : write
15+ id-token : write
1916
20- # Prevent concurrent runs for the same ref (avoids race conditions)
2117concurrency :
22- group : " pages-${{ github.ref }}" # isolate per-branch/ref
18+ group : " pages-${{ github.ref }}"
2319 cancel-in-progress : false
2420
2521jobs :
2622 build :
2723 name : Build site (Jekyll)
2824 runs-on : ubuntu-latest
29- outputs :
30- page_artifact : ${{ steps.upload-artifact.outputs.artifact-path || '' }}
3125 steps :
3226 - name : Checkout repository
3327 uses : actions/checkout@v4
3832 - name : Set up Ruby (for Jekyll)
3933 uses : ruby/setup-ruby@v1
4034 with :
41- ruby-version : ' 3.2' # pick an appropriate Ruby version for your site
42- bundler-cache : true # optional: automatically caches gems (fallback)
35+ ruby-version : ' 3.2'
36+ bundler-cache : true
4337
44- # If you prefer explicit caching control, here's a cache step for vendor/bundle:
4538 - name : Cache bundler gems
4639 uses : actions/cache@v4
4740 with :
@@ -50,34 +43,29 @@ jobs:
5043 restore-keys : |
5144 ${{ runner.os }}-gems-
5245
53- - name : Configure Bundler & install dependencies
46+ - name : Install dependencies
5447 run : |
55- # Use vendor/bundle for reproducible builds and to make cache effective
5648 bundle config set --local path 'vendor/bundle'
57- # Install with retries for network resilience
5849 bundle install --jobs 4 --retry 3
5950
6051 - name : Build Jekyll site
6152 run : |
62- # Explicit source/destination keeps things deterministic
6353 bundle exec jekyll build --source site --destination _site
6454 env :
65- # Ensure Jekyll sees production-like environment
6655 JEKYLL_ENV : production
6756
68- - name : Validate _site exists
57+ - name : Validate build
6958 run : |
7059 if [ ! -d "_site" ]; then
7160 echo "_site wasn't generated — failing the job."
7261 exit 1
7362 fi
7463
75- - name : Upload GitHub Pages artifact
76- id : upload- artifact
77- uses : actions/upload-pages-artifact@v1
64+ # Use upload-pages-artifact v3 (recent) which is compatible with artifact v4 backend
65+ - name : Upload Pages artifact
66+ uses : actions/upload-pages-artifact@v3
7867 with :
7968 path : ./_site
80- # name is not required to be unique across repos; keep conservative naming
8169 name : java-evolution-pages
8270
8371 deploy :
@@ -86,13 +74,13 @@ jobs:
8674 runs-on : ubuntu-latest
8775 environment :
8876 name : github-pages
89- url : ${{ steps.deploy.outputs.page_url || '' }}
9077 steps :
9178 - name : Deploy to GitHub Pages
9279 id : deploy
9380 uses : actions/deploy-pages@v4
9481 with :
9582 artifact_name : java-evolution-pages
9683
97- - name : Output deploy URL
98- run : echo "Deployed to ${{ steps.deploy.outputs.page_url }}"
84+ - name : Announce deploy URL
85+ run : |
86+ echo "Deployed to ${{ steps.deploy.outputs.page_url }}"
0 commit comments