Skip to content

ci(pages): update GitHub Actions to artifact-v4-compatible workflow #1532

ci(pages): update GitHub Actions to artifact-v4-compatible workflow

ci(pages): update GitHub Actions to artifact-v4-compatible workflow #1532

name: "Deploy Jekyll with GitHub Pages (robust & artifact-v4 compatible)"
on:
push:
branches:
- master
- main
workflow_dispatch: {}
schedule:
- cron: '0 12 * * *' # daily at 12:00 UTC (adjust as needed)
permissions:
contents: read
pages: write
id-token: write
concurrency:
group: "pages-${{ github.ref }}"
cancel-in-progress: false
jobs:
build:
name: Build site (Jekyll)
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: true
fetch-depth: 0
- name: Set up Ruby (for Jekyll)
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.2'
bundler-cache: true
- name: Cache bundler gems
uses: actions/cache@v4
with:
path: vendor/bundle
key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }}
restore-keys: |
${{ runner.os }}-gems-
- name: Install dependencies
run: |
bundle config set --local path 'vendor/bundle'
bundle install --jobs 4 --retry 3
- name: Build Jekyll site
run: |
bundle exec jekyll build --source site --destination _site
env:
JEKYLL_ENV: production
- name: Validate build
run: |
if [ ! -d "_site" ]; then
echo "_site wasn't generated — failing the job."
exit 1
fi
# Use upload-pages-artifact v3 (recent) which is compatible with artifact v4 backend
- name: Upload Pages artifact
uses: actions/upload-pages-artifact@v3
with:
path: ./_site
name: java-evolution-pages
deploy:
name: Deploy to GitHub Pages
needs: build
runs-on: ubuntu-latest
environment:
name: github-pages
steps:
- name: Deploy to GitHub Pages
id: deploy
uses: actions/deploy-pages@v4
with:
artifact_name: java-evolution-pages
- name: Announce deploy URL
run: |
echo "Deployed to ${{ steps.deploy.outputs.page_url }}"