diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 00000000..e9293605 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,11 @@ +version: 2 +updates: + - package-ecosystem: "bundler" + directory: "/" + schedule: + interval: "weekly" + + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "weekly" diff --git a/.github/workflows/publish-docker.yml b/.github/workflows/publish-docker.yml index 27a3982f..5922a803 100644 --- a/.github/workflows/publish-docker.yml +++ b/.github/workflows/publish-docker.yml @@ -5,9 +5,13 @@ on: tags: [ 'v*' ] pull_request: branches: [ master ] - + env: - DOCKER_TAG_IMAGE: "ghcr.io/github/pages-gem" + REGISTRY: ghcr.io + +permissions: + contents: read + packages: write jobs: build: @@ -15,21 +19,29 @@ jobs: steps: - name: Checkout Repository - uses: actions/checkout@v2 + uses: actions/checkout@v4 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@c47758b77c9736f4b2ef4073d4d51994fabfe349 + + - name: Log in to the Container registry + uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} - name: Get Docker Metadata id: meta - uses: docker/metadata-action@v3 + uses: docker/metadata-action@369eb591f429131d6889c46b94e711f089e6ca96 with: - images: ${{ env.DOCKER_TAG_IMAGE }} - - - name: Build Docker Image - run: | - docker build -t ${{ steps.meta.outputs.tags }} -f Dockerfile . - - - name: Push to Container Registry - if: github.event_name != 'pull_request' - run: | - echo ${{ secrets.GITHUB_TOKEN }} | docker login -u ${{ github.actor }} https://ghcr.io --password-stdin - docker push ${{ steps.meta.outputs.tags }} + images: ${{ env.REGISTRY }}/${{ github.repository }} + - name: Build Docker Image and Push to Container Registry + uses: docker/build-push-action@48aba3b46d1b1fec4febb7c5d0c644b249a11355 + with: + context: . + push: ${{ github.event_name != 'pull_request' }} + platforms: linux/amd64,linux/arm64 + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} diff --git a/.github/workflows/publish-gem.yml b/.github/workflows/publish-gem.yml new file mode 100644 index 00000000..4ce9da76 --- /dev/null +++ b/.github/workflows/publish-gem.yml @@ -0,0 +1,27 @@ +name: Publish Gem + +on: + release: + types: [released] + +permissions: + contents: read + +jobs: + release: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Setup Ruby + uses: ruby/setup-ruby@a2bbe5b1b236842c1cb7dd11e8e3b51e0a616acc + with: + ruby-version: "3.3" + - name: Build gem + run: | + gem build github-pages.gemspec + - name: Publish gem + env: + GEM_HOST_API_KEY: ${{ secrets.PAGES_GEM_PUBLISH }} + run: | + gem push github-pages-*.gem diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index 80b0d2d1..615946fa 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -1,5 +1,7 @@ on: push name: cibuild on push +permissions: + contents: read jobs: build: name: "GitHub Pages Tests" @@ -7,10 +9,12 @@ jobs: strategy: matrix: ruby: - - 2.6 - - 2.7 + - '3.0' + - '3.1' + - '3.2' + - '3.3' steps: - - uses: actions/checkout@master + - uses: actions/checkout@v4 - name: script/cibuild-docker run: script/cibuild-docker env: diff --git a/.rubocop.yml b/.rubocop.yml index fbcea5f9..9cbf940c 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -23,7 +23,7 @@ require: - rubocop-performance AllCops: - TargetRubyVersion: 2.5 + TargetRubyVersion: 3.0 Exclude: - 'bin/**/*' - 'script/**/*' diff --git a/.ruby-version b/.ruby-version index 2c9b4ef4..eb39e538 100644 --- a/.ruby-version +++ b/.ruby-version @@ -1 +1 @@ -2.7.3 +3.3 diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 1b620224..00000000 --- a/.travis.yml +++ /dev/null @@ -1,22 +0,0 @@ -language: ruby -rvm: - - 2.5 - - 2.6 - - 2.7 - -branches: - only: - - master - -before_install: - - gem update --system - - gem install bundler -script: "script/cibuild" -env: - global: - - NOKOGIRI_USE_SYSTEM_LIBRARIES=true - -notifications: - email: false - -cache: bundler diff --git a/Dockerfile b/Dockerfile index 6b84ef29..6fe6a8df 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -ARG RUBY_VERSION=2.7.3 +ARG RUBY_VERSION=3.3 FROM ruby:$RUBY_VERSION RUN apt-get update \ @@ -8,8 +8,6 @@ RUN apt-get update \ make \ nodejs -RUN gem update --system - COPY .git /src/gh/pages-gem/.git COPY Gemfile* /src/gh/pages-gem/ COPY github-pages.gemspec /src/gh/pages-gem @@ -30,6 +28,8 @@ ENV LANG en_US.UTF-8 ENV LANGUAGE en_US.UTF-8 ENV LC_ALL en_US.UTF-8 +ENV BUNDLE_GEMFILE=/src/gh/pages-gem/Gemfile + WORKDIR /src/site CMD ["jekyll", "serve", "-H", "0.0.0.0", "-P", "4000"] diff --git a/Dockerfile.alpine b/Dockerfile.alpine index 3c572c2f..717b1b8e 100644 --- a/Dockerfile.alpine +++ b/Dockerfile.alpine @@ -1,4 +1,4 @@ -FROM ruby:2.7.3-alpine +FROM ruby:3.3-alpine RUN apk update && apk add --no-cache \ git @@ -17,6 +17,8 @@ ENV LANG en_US.UTF-8 ENV LANGUAGE en_US.UTF-8 ENV LC_ALL en_US.UTF-8 +ENV BUNDLE_GEMFILE=/src/gh/pages-gem/Gemfile + WORKDIR /src/site CMD ["jekyll", "serve", "-H", "0.0.0.0", "-P", "4000"] diff --git a/Gemfile b/Gemfile index 464ed458..31363899 100644 --- a/Gemfile +++ b/Gemfile @@ -8,7 +8,7 @@ gemspec gem "jekyll-octicons" group :test do - gem "rubocop", "~> 0.79" + gem "rubocop", "~> 1.37" gem "rubocop-performance" gem "webmock" end diff --git a/bin/github-pages b/bin/github-pages index d91bf9d4..5ae512c9 100755 --- a/bin/github-pages +++ b/bin/github-pages @@ -43,7 +43,7 @@ Mercenary.program(:"github-pages") do |p| c.action do |args, options| require 'github-pages-health-check' cname_path = File.expand_path "CNAME", Dir.pwd - raise "No CNAME file found in current directory" unless File.exists?(cname_path) + raise "No CNAME file found in current directory" unless File.exist?(cname_path) cname = File.open(cname_path).read.strip check = GitHubPages::HealthCheck.check(cname) puts "Checking domain #{cname}..." diff --git a/github-pages.gemspec b/github-pages.gemspec index 1a9d5486..faeb2b4c 100644 --- a/github-pages.gemspec +++ b/github-pages.gemspec @@ -25,10 +25,11 @@ Gem::Specification.new do |s| end s.add_dependency("mercenary", "~> 0.3") - s.add_dependency("nokogiri", ">= 1.12.5", "< 2.0") + s.add_dependency("nokogiri", ">= 1.16.2", "< 2.0") s.add_dependency("terminal-table", "~> 1.4") + s.add_dependency("webrick", "~> 1.8") s.add_development_dependency("jekyll_test_plugin_malicious", "~> 0.2") s.add_development_dependency("pry", "~> 0.10") s.add_development_dependency("rspec", "~> 3.3") - s.add_development_dependency("rubocop-github", "0.16.0") + s.add_development_dependency("rubocop-github", "0.20.0") end diff --git a/lib/github-pages/configuration.rb b/lib/github-pages/configuration.rb index f1759a74..0d7ee434 100644 --- a/lib/github-pages/configuration.rb +++ b/lib/github-pages/configuration.rb @@ -62,13 +62,6 @@ class Configuration }, }.freeze - # These configuration settings have corresponding instance variables on - # Jekyll::Site and need to be set properly when the config is updated. - CONFIGS_WITH_METHODS = %w( - safe lsi highlighter baseurl exclude include future unpublished - show_drafts limit_posts keep_files - ).freeze - class << self def processed?(site) site.instance_variable_get(:@_github_pages_processed) == true @@ -153,7 +146,7 @@ def restrict_and_config_markdown_processor(config) config["markdown"] = "CommonMarkGhPages" config["commonmark"] = { "extensions" => %w(table strikethrough autolink tagfilter), - "options" => %w(footnotes), + "options" => %w(unsafe footnotes), } end diff --git a/lib/github-pages/dependencies.rb b/lib/github-pages/dependencies.rb index ecaad659..52ffa371 100644 --- a/lib/github-pages/dependencies.rb +++ b/lib/github-pages/dependencies.rb @@ -7,39 +7,39 @@ module GitHubPages class Dependencies VERSIONS = { # Jekyll - "jekyll" => "3.9.0", + "jekyll" => "3.10.0", "jekyll-sass-converter" => "1.5.2", # Converters - "kramdown" => "2.3.1", + "kramdown" => "2.4.0", "kramdown-parser-gfm" => "1.1.0", - "jekyll-commonmark-ghpages" => "0.2.0", + "jekyll-commonmark-ghpages" => "0.5.1", # Misc - "liquid" => "4.0.3", - "rouge" => "3.26.0", - "github-pages-health-check" => "1.17.9", + "liquid" => "4.0.4", + "rouge" => "3.30.0", + "github-pages-health-check" => "1.18.2", # Plugins "jekyll-redirect-from" => "0.16.0", "jekyll-sitemap" => "1.4.0", - "jekyll-feed" => "0.15.1", + "jekyll-feed" => "0.17.0", "jekyll-gist" => "1.5.0", "jekyll-paginate" => "1.1.0", - "jekyll-coffeescript" => "1.1.1", + "jekyll-coffeescript" => "1.2.2", "jekyll-seo-tag" => "2.8.0", - "jekyll-github-metadata" => "2.13.0", - "jekyll-avatar" => "0.7.0", + "jekyll-github-metadata" => "2.16.1", + "jekyll-avatar" => "0.8.0", "jekyll-remote-theme" => "0.4.3", "jekyll-include-cache" => "0.2.1", # Plugins to match GitHub.com Markdown - "jemoji" => "0.12.0", + "jemoji" => "0.13.0", "jekyll-mentions" => "1.6.0", "jekyll-relative-links" => "0.6.1", "jekyll-optional-front-matter" => "0.3.2", "jekyll-readme-index" => "0.3.0", - "jekyll-default-layout" => "0.1.4", + "jekyll-default-layout" => "0.1.5", "jekyll-titles-from-headings" => "0.5.3", }.freeze diff --git a/lib/github-pages/version.rb b/lib/github-pages/version.rb index b40cc255..6d381bad 100644 --- a/lib/github-pages/version.rb +++ b/lib/github-pages/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module GitHubPages - VERSION = 224 + VERSION = 232 end diff --git a/script/cibuild-docker b/script/cibuild-docker index 7a6ca87d..374ac15e 100755 --- a/script/cibuild-docker +++ b/script/cibuild-docker @@ -2,8 +2,5 @@ set -ex -# Set the ruby version in the Action definition matrix. -: "${RUBY_VERSION:="2.7.3"}" - -docker build --build-arg "RUBY_VERSION=$RUBY_VERSION" -t github-pages . +docker build -t github-pages . docker run --rm --workdir /src/gh/pages-gem github-pages script/cibuild diff --git a/spec/fixtures/jekyll-relative-links.md b/spec/fixtures/jekyll-relative-links.md index 889348d1..bebe8a23 100644 --- a/spec/fixtures/jekyll-relative-links.md +++ b/spec/fixtures/jekyll-relative-links.md @@ -1,5 +1,7 @@ --- +excerpt: Just a relative link --- - [Jekyll](jekyll.md) + +{{ page.excerpt }} \ No newline at end of file diff --git a/spec/github-pages/configuration_spec.rb b/spec/github-pages/configuration_spec.rb index 36137e17..f9ced55a 100644 --- a/spec/github-pages/configuration_spec.rb +++ b/spec/github-pages/configuration_spec.rb @@ -83,7 +83,7 @@ expect(effective_config["markdown"]).to eql("CommonMarkGhPages") expect(effective_config["commonmark"]).to eql( "extensions" => %w(table strikethrough autolink tagfilter), - "options" => %w(footnotes) + "options" => %w(unsafe footnotes) ) end end diff --git a/spec/github-pages/integration_spec.rb b/spec/github-pages/integration_spec.rb index 35740df2..d673a418 100644 --- a/spec/github-pages/integration_spec.rb +++ b/spec/github-pages/integration_spec.rb @@ -224,6 +224,7 @@ def rm_destination context "jekyll-relative-links" do it "converts relative links" do expect(contents).to match('Jekyll') + expect(contents).to match("
Just a relative link
") # excerpt end end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index bf8614da..ef7e9e91 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -16,7 +16,7 @@ # Stub all GitHub API requests so they come back empty. config.before(:each) do - stub_request(:get, /api.github.com/) + stub_request(:get, /api\.github\.com/) .to_return(:status => 200, :body => "{}", :headers => {}) end end