diff --git a/.github/workflows/gem.yaml b/.github/workflows/gem.yaml new file mode 100644 index 0000000..aac7911 --- /dev/null +++ b/.github/workflows/gem.yaml @@ -0,0 +1,30 @@ +name: Gem +on: + push: + tags: + - 'v*.*.*' + +jobs: + gem-push: + runs-on: ubuntu-latest + permissions: + # https://docs.github.com/en/actions/reference/authentication-in-a-workflow + packages: write + steps: + - uses: actions/checkout@v2 + - name: Publish Gem package + env: + GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" + # Inspired by https://github.com/bodyshopbidsdotcom/gh-action-publish-gem-on-tag/blob/1.0.1/entrypoint.sh + run: | + GIT_VERSION=$(echo "$GITHUB_REF" | cut -d'/' -f 3-) + SPEC_VERSION=$(ruby -e 'require "rubygems"; gemspec = Dir.entries(".").find { |file| file =~ /.*\.gemspec/ }; spec = Gem::Specification::load(gemspec); puts spec.version') + if [[ "$GIT_VERSION" != "v${SPEC_VERSION}" ]]; then + echo "Ignoring, git tag version differs from gem spec version." + exit 2; + fi + mkdir -p ~/.gem + echo ":github: Bearer ${GITHUB_TOKEN}" > ~/.gem/credentials + chmod 600 ~/.gem/credentials + gem build *.gemspec + gem push --key github --host "https://rubygems.pkg.github.com/${{ github.repository_owner }}" *.gem diff --git a/Gemfile b/Gemfile index abe254d..49b345c 100644 --- a/Gemfile +++ b/Gemfile @@ -1,18 +1,6 @@ source "https://rubygems.org" ruby RUBY_VERSION -gem "jekyll", "~> 4.2.0" -gem "kramdown-parser-gfm", "1.1.0" -gem "jekyll-redirect-from", "~> 0.16.0", group: :jekyll_plugins -gem "jekyll-relative-links", "~> 0.6.1", group: :jekyll_plugins -gem "jekyll-remote-theme", "~> 0.4.3", group: :jekyll_plugins +gemspec -# Blog -gem "jekyll-feed", "~> 0.15.1", group: :jekyll_plugins -gem "jekyll-archives", "~> 2.2.1", group: :jekyll_plugins - -# Search gem "jekyll-algolia", "~> 1.7.0", group: :jekyll_plugins - -# Temporary fix until there is a release with https://github.com/jekyll/jekyll/pull/8524/ -gem "webrick", "~> 1.7" diff --git a/README.md b/README.md index e1a8eec..788c6fb 100644 --- a/README.md +++ b/README.md @@ -22,13 +22,7 @@ Requirements: * [Ruby](https://www.ruby-lang.org/) (tested with Ruby 2.7+) * [Bundler](https://bundler.io/) (if missing, install with `gem install bundler`) -To install Jekyll and plugins the first time: - -```shell -bundle install -``` - -To update Jekyll and any plugins (e.g. after changing `Gemfile`): +To install or update Jekyll and plugins: ```shell bundle update diff --git a/_config.yml b/_config.yml index 12b64eb..fbc4cd2 100644 --- a/_config.yml +++ b/_config.yml @@ -19,15 +19,6 @@ baseurl: /jekyll-theme-amethyst permalink: /:year/:month/:day/:title/ lang: en timezone: UTC -# Disable theme inheritance since this repo contains its own theme top-level theme. -# This isn't needed for plain Jekyll, but because we use github-pages as basis -# we otherwise inherit from the 'primer' theme. -# This is a problem because, Jekyll/Sass/Primer fails to compile by default, yay. -# - https://github.com/jekyll/jekyll/issues/7426 -# - https://github.com/jekyll/jekyll/issues/4268 -# - https://github.com/sindresorhus/gulp-ruby-sass/issues/232 -# – Workaround: https://github.com/github/pages-gem/issues/613 -theme: null # Files that will not be converted or published exclude: # Exclude repo docs from site output and search index @@ -45,6 +36,7 @@ exclude: # Amethyst theme options are documented at: # https://github.com/qunitjs/jekyll-theme-amethyst/blob/main/docs/config.md # +theme: jekyll-theme-amethyst amethyst: edituri_base: https://github.com/qunitjs/jekyll-theme-amethyst/blob/main/ release_base: https://github.com/qunitjs/qunit/releases/tag/ diff --git a/amethyst.gemspec b/amethyst.gemspec new file mode 100644 index 0000000..0a7df5a --- /dev/null +++ b/amethyst.gemspec @@ -0,0 +1,23 @@ +Gem::Specification.new do |spec| + spec.name = "jekyll-theme-amethyst" + spec.version = "0.1.1" + spec.summary = "https://github.com/qunitjs/jekyll-theme-amethyst" + spec.authors = ["Timo Tijhof", "Trent Willis"] + spec.files = `git ls-files -z`.split("\x0") + + spec.license = "MIT" + spec.homepage = "https://github.com/qunitjs/jekyll-theme-amethyst" + + spec.metadata["plugin_type"] = "theme" + spec.require_paths = ["lib"] + + spec.add_runtime_dependency "jekyll", ">= 4.2", "< 5.0" + spec.add_runtime_dependency "kramdown-parser-gfm", "~> 1.1.0" + spec.add_runtime_dependency "jekyll-redirect-from", "~> 0.16.0" + spec.add_runtime_dependency "jekyll-relative-links", "~> 0.6.1" + # For blog + spec.add_runtime_dependency "jekyll-feed", "~> 0.15.1" + spec.add_runtime_dependency "jekyll-archives", "~> 2.2.1" + # Temporary fix until there is a release with https://github.com/jekyll/jekyll/pull/8524/ + spec.add_runtime_dependency "webrick", "~> 1.7" +end