Skip to content

feat: testing workflows for telegram notify #1574

feat: testing workflows for telegram notify

feat: testing workflows for telegram notify #1574

name: "Deploy Jekyll with GitHub Pages (robust)"
on:
push:
branches:
- main
- master
workflow_dispatch: {}
schedule:
# Run daily at 3:00 AM IST (21:30 UTC previous day)
- cron: '30 21 * * *'
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
timeout-minutes: 30
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: true
fetch-depth: 0
- name: Setup Pages (configure Pages environment)
uses: actions/configure-pages@v5
- name: Detect Gemfile location
id: detect_gemfile
run: |
if [ -f "site/Gemfile" ]; then
echo "gem_dir=site" >> $GITHUB_OUTPUT
echo "Found Gemfile in site/"
elif [ -f "Gemfile" ]; then
echo "gem_dir=." >> $GITHUB_OUTPUT
echo "Found Gemfile in repo root"
else
echo "gem_dir=NONE" >> $GITHUB_OUTPUT
echo "No Gemfile found in site/ or repo root — will use Jekyll builder action fallback."
fi
# If Gemfile exists, set up Ruby + Bundler and build with bundle exec
- name: Set up Ruby (only when Gemfile present)
if: ${{ steps.detect_gemfile.outputs.gem_dir != 'NONE' }}
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.2'
bundler-cache: false
- name: Cache bundler gems (only when Gemfile present)
if: ${{ steps.detect_gemfile.outputs.gem_dir != 'NONE' }}
uses: actions/cache@v4
id: cache-bundler
with:
path: vendor/bundle
key: ${{ runner.os }}-gems-${{ steps.detect_gemfile.outputs.gem_dir }}-${{ hashFiles(format('{0}/Gemfile.lock', steps.detect_gemfile.outputs.gem_dir)) }}
restore-keys: |
${{ runner.os }}-gems-${{ steps.detect_gemfile.outputs.gem_dir }}-
- name: Install Ruby gems with Bundler (only when Gemfile present)
if: ${{ steps.detect_gemfile.outputs.gem_dir != 'NONE' }}
run: |
echo "Using Gemfile from: ${{ steps.detect_gemfile.outputs.gem_dir }}"
cd ${{ steps.detect_gemfile.outputs.gem_dir }}
bundle config set --local path 'vendor/bundle'
# retry logic to cope with transient network errors
bundle install --jobs 4 --retry 3
shell: bash
- name: Build site with Bundler (only when Gemfile present)
if: ${{ steps.detect_gemfile.outputs.gem_dir != 'NONE' }}
run: |
cd ${{ steps.detect_gemfile.outputs.gem_dir }}
echo "Building Jekyll with bundle exec..."
bundle exec jekyll build --source . --destination ../_site
env:
JEKYLL_ENV: production
shell: bash
# Fallback: if there's no Gemfile, use the jekyll-build-pages action (best-effort)
- name: Build with actions/jekyll-build-pages (fallback)
if: ${{ steps.detect_gemfile.outputs.gem_dir == 'NONE' }}
uses: actions/jekyll-build-pages@v1
with:
source: ./site
destination: ./_site
- name: Validate _site exists
run: |
if [ ! -d "_site" ]; then
echo "_site wasn't generated — failing the job."
ls -la
exit 1
fi
- 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: deployment
uses: actions/deploy-pages@v4
with:
artifact_name: java-evolution-pages
- name: Output deploy URL
run: echo "Deployed to ${{ steps.deployment.outputs.page_url }}"