Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate validation to Jekyll hooks #2859

Merged
merged 1 commit into from
Aug 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ updates:
directory: "/" # Location of package manifests
schedule:
interval: "daily"

# This updates the _data/release-data submodule once a day
# which itself is updated twice a day.
- package-ecosystem: "gitsubmodule"
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/auto-merge-release-updates.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ jobs:
status_options: '--untracked-files=no'
commit_author: 'github-actions[bot] <github-actions[bot]@users.noreply.github.com>'

# TODO: Leave a comment if there is a new major release that we don't match
- name: Enable auto-merge for Dependabot PRs for release data
if: ${{contains(steps.metadata.outputs.dependency-names, '_data/release-data')}}
run: gh pr merge --auto --rebase "$PR_URL"
Expand Down
23 changes: 23 additions & 0 deletions .github/workflows/check-links.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Check URLs

on:
schedule:
- cron: '0 0 * * 0' # At 00:00 on Sunday.

jobs:
check_urls:
runs-on: ubuntu-latest
steps:
- name: Checkout site
uses: actions/checkout@v2

- name: Setup ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 3.1
bundler-cache: true

- name: Perform URLs check
run: bundle exec jekyll build
env:
MUST_CHECK_URLS: true
19 changes: 0 additions & 19 deletions .github/workflows/validate.yaml

This file was deleted.

3 changes: 3 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,6 @@ gem "wdm", "~> 0.1.0" if Gem.win_platform?
gem "webrick", "~> 1.8"

gem 'icalendar', '~> 2.9'

# Used in product-data-validator to check URLs
gem "open-uri", "~> 0.3"
10 changes: 10 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ GEM
public_suffix (>= 2.0.2, < 6.0)
colorator (1.1.0)
concurrent-ruby (1.2.2)
date (3.3.3)
em-websocket (0.5.3)
eventmachine (>= 0.12.9)
http_parser.rb (~> 0)
Expand Down Expand Up @@ -80,6 +81,10 @@ GEM
racc (~> 1.4)
nokogiri (1.15.3-x86_64-linux)
racc (~> 1.4)
open-uri (0.3.0)
stringio
time
uri
pathutil (0.16.2)
forwardable-extended (~> 2.6)
posix-spawn (0.3.15)
Expand All @@ -96,11 +101,15 @@ GEM
google-protobuf (~> 3.23)
sass-embedded (1.64.2-x86_64-linux-gnu)
google-protobuf (~> 3.23)
stringio (3.0.8)
terminal-table (3.0.2)
unicode-display_width (>= 1.1.1, < 3)
time (0.2.2)
date
tzinfo (2.0.6)
concurrent-ruby (~> 1.0)
unicode-display_width (2.4.2)
uri (0.12.2)
webrick (1.8.1)

PLATFORMS
Expand All @@ -116,6 +125,7 @@ DEPENDENCIES
jekyll-timeago
jemoji
just-the-docs (~> 0.5.1)
open-uri (~> 0.3)
tzinfo-data
webrick (~> 1.8)

Expand Down
31 changes: 20 additions & 11 deletions _auto/deploy.sh
Original file line number Diff line number Diff line change
@@ -1,15 +1,24 @@
#!/bin/bash
#!/bin/bash -e

### Update latest information
# See https://github.com/endoflife-date/endoflife.date/pull/2081
git submodule update --remote
# Display context information
echo "Current commit: $(git rev-parse HEAD)"
echo "Ruby version: $(ruby --version)"
echo "Python version: $(python --version)"
echo "Jekyll version: $(bundle exec jekyll --version)"
echo "Deploy URL: $1"

# Update latest product information, see https://github.com/endoflife-date/endoflife.date/pull/2081
pip install -r requirements.txt
# If the latest.py script fails,
# We don't want to raise any errors
# just undo the changes, and carry on
if ! python3 _auto/latest.py ; then
git checkout -- products/
git submodule update --remote
if ! python3 _auto/latest.py ; then # if the latest.py script fails...
git checkout -- products/ # ...just undo the changes, and carry on
fi

# Replace the Deploy URL with the Preview URL
if [ -n "$1" ]; then
echo "Replacing Deploy URL with Preview URL ($1)"
sed -i "/url\:/curl\: $1" _config.yml
fi

# Finally, do a build
bundle exec jekyll build
# Finally, do a full build
bundle exec jekyll build --trace
127 changes: 0 additions & 127 deletions _auto/validate.py

This file was deleted.

3 changes: 3 additions & 0 deletions _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,9 @@ defaults:
path: "products"
values:
layout: product
alternate_urls: []
identifiers: []
auto: []
releaseColumn: true
releaseColumnLabel: 'Latest'
releaseDateColumn: false
Expand Down
2 changes: 1 addition & 1 deletion _plugins/product-data-enricher.rb
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,6 @@ def render_eol_template(template, cycle)
end
end

Jekyll::Hooks.register [:pages], :post_init do |page|
Jekyll::Hooks.register [:pages], :post_init, priority: Jekyll::Hooks::PRIORITY_MAP[:normal] do |page|
Jekyll::ProductDataEnricher.enrich(page) if Jekyll::ProductDataEnricher.is_product?(page)
end