Skip to content

Commit 959fbec

Browse files
ultimatecoderJaysinh Shukla
andauthored
Modernize build/deploy: Jekyll 4.4, GitHub Actions, GitHub Pages (#99)
* Modernize build/deploy: Jekyll 4.4, GitHub Actions, GitHub Pages - Upgrade Jekyll 3.8.5 -> 4.4.1, pin Ruby 3.2.0, refresh gem dependencies and add x86_64-linux to the lockfile so CI can install on Linux runners - Add bundler-audit as a dev dependency; no known CVEs found - Fix scripts/test: htmlproofer was silently checking zero pages because the shell's missing LANG made Ruby default to US-ASCII; also drop the https-enforcement noise on old post links and ignore confirmed-dead external URLs - Retire the dead Travis CI / rsync-to-jaysinh.com pipeline (.travis.yml, scripts/deploy, CNAME, keypair.pem.enc) since that domain is no longer owned; the site now targets https://ultimatecoder.github.io/Blog/ with the matching /Blog baseurl - Add .github/workflows/ci.yml (build + link-check on PRs) and pages.yml (build + deploy to GitHub Pages on push to master) * Ignore two more external links that block GitHub Actions' IPs pythonexpress.in and hackerearth.com both return 200 from a normal network but 403 specifically from GitHub-hosted runner IPs (bot/WAF blocking, not a dead link) - confirmed via the ci.yml failure on PR #99. * Address PR review: fail-fast, security scan, minifier, image baseurl fix - scripts/build & scripts/test: add set -euo pipefail (and a shebang to scripts/test) so a failed build aborts CI instead of link-checking a stale _site (review #1) - scripts/test: move the --ignore-urls list into a documented bash array (review #5); note the baseurl<->swap-urls coupling in _config.yml (#6) - ci.yml: run bundle exec bundler-audit check --update as a real per-PR security scan (#2); add least-privilege permissions: contents: read (#3) - Pin all workflow actions to commit SHAs with version comments (#4) - Re-add minification via jekyll-minifier 0.2.2 (Jekyll 4-compatible, production-only) (#7) - Drop analytics: remove the leftover GA placeholder; UA died in 2023 (#8) - Fix 45 image references across 11 posts + about.md that used {{site.url}}/assets or hardcoded /assets and omitted baseurl, so they 404'd on the /Blog project-page URL. Verified via a production (minified) build + htmlproofer run with all internal links resolving. --------- Co-authored-by: Jaysinh Shukla <jaysinhshukla@Jaysinhs-MacBook-Pro-2.local>
1 parent 13f91cf commit 959fbec

28 files changed

Lines changed: 322 additions & 192 deletions

.github/workflows/ci.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: CI
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- master
7+
workflow_dispatch:
8+
9+
permissions:
10+
contents: read
11+
12+
jobs:
13+
build-and-test:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: Checkout
17+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
18+
19+
- name: Set up Ruby
20+
uses: ruby/setup-ruby@44511735964dcb71245e7e55f72539531f7bc0eb # v1.257.0
21+
with:
22+
ruby-version: "3.2.0"
23+
bundler-cache: true
24+
25+
- name: Security audit (bundler-audit)
26+
run: bundle exec bundler-audit check --update
27+
28+
- name: Build and check links
29+
run: ./scripts/test

.github/workflows/pages.yml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: Deploy to GitHub Pages
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
workflow_dispatch:
8+
9+
permissions:
10+
contents: read
11+
pages: write
12+
id-token: write
13+
14+
concurrency:
15+
group: pages
16+
cancel-in-progress: false
17+
18+
jobs:
19+
build:
20+
runs-on: ubuntu-latest
21+
steps:
22+
- name: Checkout
23+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
24+
25+
- name: Set up Ruby
26+
uses: ruby/setup-ruby@44511735964dcb71245e7e55f72539531f7bc0eb # v1.257.0
27+
with:
28+
ruby-version: "3.2.0"
29+
bundler-cache: true
30+
31+
- name: Build site
32+
env:
33+
JEKYLL_ENV: production
34+
run: bundle exec jekyll build --config _config.yml,_config_production.yml
35+
36+
- name: Upload Pages artifact
37+
uses: actions/upload-pages-artifact@56afc609e74202658d3ffba0e8f6dda462b719fa # v3.0.1
38+
with:
39+
path: ./_site
40+
41+
deploy:
42+
needs: build
43+
runs-on: ubuntu-latest
44+
environment:
45+
name: github-pages
46+
url: ${{ steps.deployment.outputs.page_url }}
47+
steps:
48+
- name: Deploy to GitHub Pages
49+
id: deployment
50+
uses: actions/deploy-pages@d6db90164ac5ed86f2b6aed7e0febac5b3c0c03e # v4.0.5

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,7 @@ tags
2020
## Environment normalization:
2121
/.bundle/
2222
/vendor/bundle
23+
24+
# Sensitive key material — never commit
25+
keypair.pem
26+
keypair.pem.enc

.ruby-version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
3.2.0

.travis.yml

Lines changed: 0 additions & 26 deletions
This file was deleted.

CNAME

Lines changed: 0 additions & 1 deletion
This file was deleted.

Gemfile

Lines changed: 13 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,20 @@
11
source "https://rubygems.org"
2-
ruby RUBY_VERSION
32

4-
# Hello! This is where you manage which Jekyll version is used to run.
5-
# When you want to use a different version, change it below, save the
6-
# file and run `bundle install`. Run Jekyll with `bundle exec`, like so:
7-
#
8-
# bundle exec jekyll serve
9-
#
10-
# This will help ensure the proper Jekyll version is running.
11-
# Happy Jekylling!
12-
gem "jekyll"
3+
# Jekyll version
4+
gem "jekyll", "~> 4.4"
135

14-
# This is the default theme for new Jekyll sites. You may change this to anything you like.
15-
gem "minima", "~> 2.0"
16-
gem "html-proofer"
6+
# Theme
7+
gem "minima", "~> 2.5"
178

18-
# If you want to use GitHub Pages, remove the "gem "jekyll"" above and
19-
# uncomment the line below. To upgrade, run `bundle update github-pages`.
20-
# gem "github-pages", group: :jekyll_plugins
9+
# Development/testing
10+
gem "html-proofer"
11+
gem "bundler-audit"
2112

22-
# If you have any plugins, put them here!
13+
# Jekyll plugins
2314
group :jekyll_plugins do
24-
gem "jekyll-feed", "~> 0.6"
25-
gem "jekyll-minifier"
26-
gem "jekyll-sitemap"
27-
gem "jekyll-seo-tag"
15+
gem "jekyll-feed", "~> 0.17"
16+
gem "jekyll-sitemap", "~> 1.4"
17+
gem "jekyll-seo-tag", "~> 2.8"
18+
# Minifies HTML/CSS/JS output; only runs when JEKYLL_ENV=production.
19+
gem "jekyll-minifier", "~> 0.2"
2820
end

0 commit comments

Comments
 (0)