├── .0pdd.yml ├── .github └── workflows │ ├── actionlint.yml │ ├── bashate.yml │ ├── copyrights.yml │ ├── markdown-lint.yml │ ├── pdd.yml │ ├── rake.yml │ ├── reuse.yml │ ├── shellcheck.yml │ ├── typos.yml │ ├── xcop.yml │ └── yamllint.yml ├── .gitignore ├── .pdd ├── .rubocop.yml ├── .rultor.yml ├── Gemfile ├── LICENSE.txt ├── LICENSES └── MIT.txt ├── README.md ├── REUSE.toml ├── Rakefile ├── bash └── deploy.sh ├── bin └── jgd ├── jgd.gemspec ├── logo.svg ├── renovate.json ├── rubygems.yml.asc └── test.sh /.0pdd.yml: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Copyright (c) 2014-2025 Yegor Bugayenko 2 | # SPDX-License-Identifier: MIT 3 | --- 4 | errors: 5 | - yegor256@gmail.com 6 | # alerts: 7 | # github: 8 | # - yegor256 9 | 10 | tags: 11 | - pdd 12 | - bug 13 | -------------------------------------------------------------------------------- /.github/workflows/actionlint.yml: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Copyright (c) 2014-2025 Yegor Bugayenko 2 | # SPDX-License-Identifier: MIT 3 | --- 4 | # yamllint disable rule:line-length 5 | name: actionlint 6 | 'on': 7 | push: 8 | branches: 9 | - master 10 | pull_request: 11 | branches: 12 | - master 13 | jobs: 14 | actionlint: 15 | timeout-minutes: 15 16 | runs-on: ubuntu-24.04 17 | steps: 18 | - uses: actions/checkout@v4 19 | - name: Download actionlint 20 | id: get_actionlint 21 | run: bash <(curl https://raw.githubusercontent.com/rhysd/actionlint/main/scripts/download-actionlint.bash) 22 | shell: bash 23 | - name: Check workflow files 24 | run: ${{ steps.get_actionlint.outputs.executable }} -color 25 | shell: bash 26 | -------------------------------------------------------------------------------- /.github/workflows/bashate.yml: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Copyright (c) 2014-2025 Yegor Bugayenko 2 | # SPDX-License-Identifier: MIT 3 | --- 4 | # yamllint disable rule:line-length 5 | name: bashate 6 | 'on': 7 | push: 8 | branches: 9 | - master 10 | pull_request: 11 | branches: 12 | - master 13 | jobs: 14 | bashate: 15 | timeout-minutes: 15 16 | runs-on: ubuntu-24.04 17 | steps: 18 | - uses: actions/checkout@v4 19 | - uses: actions/setup-python@v5 20 | with: 21 | python-version: 3.11 22 | - run: pip install bashate 23 | - run: | 24 | readarray -t files < <(find . -name '*.sh') 25 | bashate -i E006,E003 "${files[@]}" 26 | -------------------------------------------------------------------------------- /.github/workflows/copyrights.yml: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Copyright (c) 2014-2025 Yegor Bugayenko 2 | # SPDX-License-Identifier: MIT 3 | --- 4 | # yamllint disable rule:line-length 5 | name: copyrights 6 | 'on': 7 | push: 8 | branches: 9 | - master 10 | pull_request: 11 | branches: 12 | - master 13 | jobs: 14 | copyrights: 15 | timeout-minutes: 15 16 | runs-on: ubuntu-24.04 17 | steps: 18 | - uses: actions/checkout@v4 19 | - uses: yegor256/copyrights-action@0.0.8 20 | -------------------------------------------------------------------------------- /.github/workflows/markdown-lint.yml: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Copyright (c) 2014-2025 Yegor Bugayenko 2 | # SPDX-License-Identifier: MIT 3 | --- 4 | # yamllint disable rule:line-length 5 | name: markdown-lint 6 | 'on': 7 | push: 8 | branches: 9 | - master 10 | pull_request: 11 | branches: 12 | - master 13 | jobs: 14 | markdown-lint: 15 | timeout-minutes: 15 16 | runs-on: ubuntu-24.04 17 | steps: 18 | - uses: actions/checkout@v4 19 | - uses: DavidAnson/markdownlint-cli2-action@v20.0.0 20 | -------------------------------------------------------------------------------- /.github/workflows/pdd.yml: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Copyright (c) 2014-2025 Yegor Bugayenko 2 | # SPDX-License-Identifier: MIT 3 | --- 4 | # yamllint disable rule:line-length 5 | name: pdd 6 | 'on': 7 | push: 8 | branches: 9 | - master 10 | pull_request: 11 | branches: 12 | - master 13 | jobs: 14 | pdd: 15 | timeout-minutes: 15 16 | runs-on: ubuntu-24.04 17 | steps: 18 | - uses: actions/checkout@v4 19 | - uses: volodya-lombrozo/pdd-action@master 20 | -------------------------------------------------------------------------------- /.github/workflows/rake.yml: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Copyright (c) 2014-2025 Yegor Bugayenko 2 | # SPDX-License-Identifier: MIT 3 | --- 4 | # yamllint disable rule:line-length 5 | name: rake 6 | 'on': 7 | push: 8 | branches: 9 | - master 10 | pull_request: 11 | branches: 12 | - master 13 | jobs: 14 | rake: 15 | strategy: 16 | matrix: 17 | os: [ubuntu-24.04, macos-15, windows-2022] 18 | ruby: [3.3] 19 | runs-on: ${{ matrix.os }} 20 | steps: 21 | - uses: actions/checkout@v4 22 | - uses: ruby/setup-ruby@v1 23 | with: 24 | ruby-version: ${{ matrix.ruby }} 25 | bundler-cache: true 26 | - run: bundle config set --global path "$(pwd)/vendor/bundle" 27 | - run: bundle install --no-color 28 | - run: bundle exec rake 29 | -------------------------------------------------------------------------------- /.github/workflows/reuse.yml: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Copyright (c) 2014-2025 Yegor Bugayenko 2 | # SPDX-License-Identifier: MIT 3 | --- 4 | # yamllint disable rule:line-length 5 | name: reuse 6 | 'on': 7 | push: 8 | branches: 9 | - master 10 | pull_request: 11 | branches: 12 | - master 13 | jobs: 14 | reuse: 15 | timeout-minutes: 15 16 | runs-on: ubuntu-24.04 17 | steps: 18 | - uses: actions/checkout@v4 19 | - uses: fsfe/reuse-action@v5 20 | -------------------------------------------------------------------------------- /.github/workflows/shellcheck.yml: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Copyright (c) 2014-2025 Yegor Bugayenko 2 | # SPDX-License-Identifier: MIT 3 | --- 4 | # yamllint disable rule:line-length 5 | name: shellcheck 6 | 'on': 7 | push: 8 | branches: 9 | - master 10 | pull_request: 11 | branches: 12 | - master 13 | jobs: 14 | shellcheck: 15 | timeout-minutes: 15 16 | runs-on: ubuntu-24.04 17 | steps: 18 | - uses: actions/checkout@v4 19 | - uses: ludeeus/action-shellcheck@master 20 | -------------------------------------------------------------------------------- /.github/workflows/typos.yml: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Copyright (c) 2014-2025 Yegor Bugayenko 2 | # SPDX-License-Identifier: MIT 3 | --- 4 | # yamllint disable rule:line-length 5 | name: typos 6 | 'on': 7 | push: 8 | branches: 9 | - master 10 | pull_request: 11 | branches: 12 | - master 13 | jobs: 14 | typos: 15 | timeout-minutes: 15 16 | runs-on: ubuntu-24.04 17 | steps: 18 | - uses: actions/checkout@v4 19 | - uses: crate-ci/typos@v1.32.0 20 | -------------------------------------------------------------------------------- /.github/workflows/xcop.yml: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Copyright (c) 2014-2025 Yegor Bugayenko 2 | # SPDX-License-Identifier: MIT 3 | --- 4 | # yamllint disable rule:line-length 5 | name: xcop 6 | 'on': 7 | push: 8 | branches: 9 | - master 10 | pull_request: 11 | branches: 12 | - master 13 | jobs: 14 | xcop: 15 | timeout-minutes: 15 16 | runs-on: ubuntu-24.04 17 | steps: 18 | - uses: actions/checkout@v4 19 | - uses: g4s8/xcop-action@master 20 | -------------------------------------------------------------------------------- /.github/workflows/yamllint.yml: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Copyright (c) 2014-2025 Yegor Bugayenko 2 | # SPDX-License-Identifier: MIT 3 | --- 4 | # yamllint disable rule:line-length 5 | name: yamllint 6 | 'on': 7 | push: 8 | branches: 9 | - master 10 | pull_request: 11 | branches: 12 | - master 13 | jobs: 14 | yamllint: 15 | timeout-minutes: 15 16 | runs-on: ubuntu-24.04 17 | steps: 18 | - uses: actions/checkout@v4 19 | - uses: ibiqlik/action-yamllint@v3 20 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .bundle/ 2 | .DS_Store 3 | .idea/ 4 | .yardoc/ 5 | *.gem 6 | coverage/ 7 | doc/ 8 | Gemfile.lock 9 | node_modules/ 10 | rdoc/ 11 | vendor/ 12 | -------------------------------------------------------------------------------- /.pdd: -------------------------------------------------------------------------------- 1 | --source=. 2 | --verbose 3 | --exclude target/**/* 4 | --exclude src/main/resources/images/**/* 5 | --rule min-words:20 6 | --rule min-estimate:15 7 | --rule max-estimate:90 8 | -------------------------------------------------------------------------------- /.rubocop.yml: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Copyright (c) 2014-2025 Yegor Bugayenko 2 | # SPDX-License-Identifier: MIT 3 | --- 4 | AllCops: 5 | Exclude: 6 | - 'bin/**/*' 7 | - 'assets/**/*' 8 | - 'vendor/**/*' 9 | DisplayCopNames: true 10 | TargetRubyVersion: '2.3' 11 | NewCops: enable 12 | SuggestExtensions: false 13 | Lint/RescueException: 14 | Enabled: false 15 | Metrics/MethodLength: 16 | Max: 50 17 | Metrics/ClassLength: 18 | Max: 150 19 | Metrics/AbcSize: 20 | Max: 60 21 | Metrics/BlockLength: 22 | Max: 50 23 | Layout/MultilineMethodCallIndentation: 24 | Enabled: false 25 | require: 26 | - rubocop-rake 27 | - rubocop-minitest 28 | - rubocop-performance 29 | -------------------------------------------------------------------------------- /.rultor.yml: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Copyright (c) 2014-2025 Yegor Bugayenko 2 | # SPDX-License-Identifier: MIT 3 | --- 4 | # yamllint disable rule:line-length 5 | docker: 6 | image: yegor256/rultor-image:1.24.0 7 | readers: 8 | - "urn:github:526301" 9 | decrypt: 10 | rubygems.yml: repo/rubygems.yml.asc 11 | install: |- 12 | git config --global user.email "test@example.com" 13 | git config --global user.name "Test" 14 | bundle install --no-color 15 | release: 16 | pre: false 17 | script: |- 18 | bundle exec rake 19 | ./test.sh 20 | rm -rf *.gem 21 | sed -i "s/2.0.snapshot/${tag}/g" jgd.gemspec 22 | gem build jgd.gemspec 23 | chmod 0600 ../rubygems.yml 24 | gem push *.gem --config-file ../rubygems.yml 25 | merge: 26 | script: |- 27 | bundle exec rake 28 | ./test.sh 29 | -------------------------------------------------------------------------------- /Gemfile: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # SPDX-FileCopyrightText: Copyright (c) 2014-2025 Yegor Bugayenko 4 | # SPDX-License-Identifier: MIT 5 | 6 | source 'https://rubygems.org' 7 | gemspec 8 | 9 | gem 'rake', '~>13.2', require: false 10 | gem 'rubocop', '~>1.59', require: false 11 | gem 'rubocop-minitest', '>0', require: false 12 | gem 'rubocop-performance', '>0', require: false 13 | gem 'rubocop-rake', '>0', require: false 14 | gem 'rubocop-rspec', '~>2.31', require: false 15 | -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | (The MIT License) 2 | 3 | Copyright (c) 2014-2025 Yegor Bugayenko 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the 'Software'), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /LICENSES/MIT.txt: -------------------------------------------------------------------------------- 1 | (The MIT License) 2 | 3 | Copyright (c) 2014-2025 Yegor Bugayenko 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the 'Software'), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | [![DevOps By Rultor.com](https://www.rultor.com/b/yegor256/jekyll-github-deploy)](https://www.rultor.com/p/yegor256/jekyll-github-deploy) 4 | [![We recommend RubyMine](https://www.elegantobjects.org/rubymine.svg)](https://www.jetbrains.com/ruby/) 5 | 6 | [![rake](https://github.com/yegor256/jekyll-github-deploy/actions/workflows/rake.yml/badge.svg)](https://github.com/yegor256/jekyll-github-deploy/actions/workflows/rake.yml) 7 | [![Gem Version](https://badge.fury.io/rb/jgd.svg)](https://badge.fury.io/rb/jgd) 8 | [![Hits-of-Code](https://hitsofcode.com/github/yegor256/jekyll-github-deploy)](https://hitsofcode.com/view/github/yegor256/jekyll-github-deploy) 9 | [![License](https://img.shields.io/badge/license-MIT-green.svg)](https://github.com/yegor256/jekyll-github-deploy/blob/master/LICENSE.txt) 10 | 11 | If you use some plugins with your [Jekyll](https://jekyllrb.com/) blog, chances are you can not 12 | have your blog generated by [GitHub Pages](https://pages.github.com/). 13 | First of all, because they [do not allow](https://help.github.com/en/articles/adding-jekyll-plugins-to-a-github-pages-site) 14 | custom plugins. 15 | This is where jekyll-github-deploy (a.k.a. jgd) comes in: it will 16 | automatically build your Jekyll blog and push it to your gh-pages 17 | branch. You may want to read this blog post before you start 18 | using this tool: 19 | [_Deploy Jekyll to GitHub Pages_](https://www.yegor256.com/2014/06/24/jekyll-github-deploy.html). 20 | 21 | It is assumed that your blog is in the home directory of your repo. 22 | 23 | Install it first: 24 | 25 | ```bash 26 | $ gem install jgd 27 | ``` 28 | 29 | Run it locally: 30 | 31 | ```bash 32 | $ jgd 33 | ``` 34 | 35 | Now your site is deployed to `gh-pages` branch of your repo. Done. 36 | 37 | Below is a list of all command line options. 38 | 39 | | Option | Description | 40 | | -------- | ----------- | 41 | | `-u` or `--url` | The GitHub URL. Defaults to th URL of your current project. | 42 | | `-b` or `--branch` | The branch to push your site to. Defaults to `gh-pages`. If the branch does not exist, it will be created. | 43 | | `-r` or `--branch-from` | The source branch. Defaults to `master`. | 44 | | `-c` or `--config` | Name of the optional deploy config file. See [Production variables](#production-variables) below for more information. | 45 | | `-d` or `--drafts` | Adds the `--drafts` option to Jekyll so that it will build draft posts. | 46 | | `-h` or `--help` | Displays a list of all options. | 47 | 48 | If you need to have different values for your deployed blog, just add a 49 | `_config-deploy.yml` file in your project's root and you're set. Values 50 | re-defined in `_config-deploy.yml` will override those defined in 51 | `_config.yml`. 52 | 53 | Typical usage includes changing site `url`, disable disqus or ga in 54 | development...., you name it. 55 | 56 | While `_config-deploy.yml` is the default, you may specify any config 57 | file by using the `--config` command line option. 58 | 59 | For example: 60 | ```sh 61 | $ jgd -c _config-deploy-develop.yml -r develop -b gh-pages-develop 62 | ``` 63 | 64 | ## Deploying with Travis 65 | 66 | This is how I configure [my Jekyll blog](https://github.com/yegor256/blog) 67 | to be deployed automatically by [travis-ci](http://www.travis-ci.org): 68 | 69 | ```yaml 70 | branches: 71 | only: 72 | - master 73 | env: 74 | global: 75 | - secure: ... 76 | install: 77 | - bundle 78 | script: jgd -u http://yegor256:$PASSWORD@github.com/yegor256/blog.git 79 | ``` 80 | 81 | The environment variable `$PASSWORD` is set through 82 | `env/global/secure`, as explained 83 | [here](http://docs.travis-ci.com/user/encryption-keys/). 84 | 85 | Don't forget to add `gem require 'jgd'` to your `Gemfile`. 86 | 87 | You can use SSH key instead. First, you should [encrypt](https://docs.travis-ci.com/user/encrypting-files/) it: 88 | 89 | ```bash 90 | $ travis encrypt-file id_rsa --add 91 | ``` 92 | 93 | Then, use the URI that starts with `git@`: 94 | 95 | ```yaml 96 | script: 97 | - jgd -u git@github.com:yegor256/blog.git 98 | ``` 99 | 100 | ## Building locally 101 | 102 | In order to build a package locally run below commands. 103 | 104 | ```bash 105 | gem build jgd.gemspec 106 | gem install jgd-.gem 107 | ``` 108 | 109 | ## How to Contribute 110 | 111 | First, install 112 | [Ruby 2.3+](https://www.ruby-lang.org/en/documentation/installation/), 113 | [Rubygems](https://rubygems.org/pages/download), 114 | and 115 | [Bundler](https://bundler.io/). 116 | Then: 117 | 118 | ```bash 119 | $ bundle update 120 | $ bundle exec rake --quiet 121 | $ ./tesh.sh 122 | ``` 123 | 124 | The build has to be clean. If it's not, [submit an issue](https://github.com/zold-io/out/issues). 125 | 126 | Then, make your changes, make sure the build is still clean, 127 | and [submit a pull request](https://www.yegor256.com/2014/04/15/github-guidelines.html). 128 | -------------------------------------------------------------------------------- /REUSE.toml: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Copyright (c) 2025 Yegor Bugayenko 2 | # SPDX-License-Identifier: MIT 3 | 4 | version = 1 5 | [[annotations]] 6 | path = [ 7 | ".DS_Store", 8 | ".gitattributes", 9 | ".gitignore", 10 | ".pdd", 11 | "**.json", 12 | "**.md", 13 | "**.svg", 14 | "**.txt", 15 | "**/.DS_Store", 16 | "**/.gitignore", 17 | "**/.pdd", 18 | "**/*.csv", 19 | "**/*.jpg", 20 | "**/*.json", 21 | "**/*.md", 22 | "**/*.pdf", 23 | "**/*.png", 24 | "**/*.svg", 25 | "**/*.txt", 26 | "**/*.vm", 27 | "**/CNAME", 28 | "**/Gemfile.lock", 29 | "Gemfile.lock", 30 | "README.md", 31 | "renovate.json", 32 | "rubygems.yml.asc", 33 | ] 34 | precedence = "override" 35 | SPDX-FileCopyrightText = "Copyright (c) 2025 Yegor Bugayenko" 36 | SPDX-License-Identifier = "MIT" 37 | -------------------------------------------------------------------------------- /Rakefile: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # SPDX-FileCopyrightText: Copyright (c) 2014-2025 Yegor Bugayenko 4 | # SPDX-License-Identifier: MIT 5 | 6 | require 'rubygems' 7 | require 'rake' 8 | require 'rake/clean' 9 | 10 | CLEAN = FileList['coverage', 'rdoc'] 11 | 12 | def name 13 | @name ||= File.basename(Dir['*.gemspec'].first, '.*') 14 | end 15 | 16 | def version 17 | Gem::Specification.load(Dir['*.gemspec'].first).version 18 | end 19 | 20 | task default: %i[clean rubocop] 21 | 22 | require 'rubocop/rake_task' 23 | RuboCop::RakeTask.new(:rubocop) do |task| 24 | task.fail_on_error = true 25 | task.requires << 'rubocop-rspec' 26 | end 27 | -------------------------------------------------------------------------------- /bash/deploy.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # SPDX-FileCopyrightText: Copyright (c) 2025 Yegor Bugayenko 4 | # SPDX-License-Identifier: MIT 5 | 6 | set -ex -o pipefail 7 | 8 | URL=$1 9 | BRANCH=$2 10 | BRANCH_FROM=$3 11 | DEPLOY_CONFIG=$4 12 | BUNDLE=$5 13 | DRAFTS=$6 14 | TEMP=$(mktemp -d -t jgd-XXX) 15 | trap 'rm -rf ${TEMP}' EXIT 16 | CLONE=${TEMP}/clone 17 | COPY=${TEMP}/copy 18 | 19 | echo -e "Cloning Github repository:" 20 | git clone -b "${BRANCH_FROM}" "${URL}" "${CLONE}" 21 | cp -R "${CLONE}" "${COPY}" 22 | 23 | cd "${CLONE}" 24 | 25 | echo -e "\nBuilding Jekyll site:" 26 | rm -rf _site 27 | 28 | if [ -r "${DEPLOY_CONFIG}" ]; then 29 | "${BUNDLE}" jekyll build --config "_config.yml,${DEPLOY_CONFIG}" "${DRAFTS}" 30 | else 31 | "${BUNDLE}" jekyll build "${DRAFTS}" 32 | fi 33 | 34 | if [ ! -e _site ]; then 35 | echo -e "\nJekyll didn't generate anything in _site!" 36 | exit 1 37 | fi 38 | 39 | cp -R _site "${TEMP}" || exit 1 40 | 41 | cd "${TEMP}" 42 | rm -rf "${CLONE}" 43 | mv "${COPY}" "${CLONE}" 44 | cd "${CLONE}" 45 | 46 | echo -e "\nPreparing ${BRANCH} branch:" 47 | if git branch -a | grep -q "origin/${BRANCH}"; then 48 | git checkout --orphan "${BRANCH}" 49 | else 50 | git checkout "${BRANCH}" 51 | fi 52 | 53 | echo -e "\nDeploying into ${BRANCH} branch:" 54 | rm -rf ./** 55 | cp -R "${TEMP}/_site"/* . 56 | rm -f README.md 57 | git add . 58 | git commit -am "new version $(date)" --allow-empty 59 | git push origin "${BRANCH}" 2>&1 | sed 's|'"${URL}"'|[skipped]|g' 60 | 61 | echo -e "\nCleaning up:" 62 | rm -rf "${CLONE}" 63 | rm -rf "${SITE}" 64 | -------------------------------------------------------------------------------- /bin/jgd: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | 3 | # SPDX-FileCopyrightText: Copyright (c) 2014-2025 Yegor Bugayenko 4 | # SPDX-License-Identifier: MIT 5 | 6 | STDOUT.sync = true 7 | 8 | require 'trollop' 9 | opts = Trollop.options do 10 | banner <<-EOS 11 | jgd is an automated deployer of Jekyll site to Github Pages 12 | 13 | Usage: jgd [options] 14 | EOS 15 | opt :url, 'Github URL', type: String, default: '' 16 | opt :branch, 'Destination branch', type: String, default: 'gh-pages' 17 | opt :branch_from, 'Source branch', type: String, default: 'master' 18 | opt :config, 'Deploy Config File', type: String, default: '_config-deploy.yml' 19 | opt :bundle, 'Use bundle' 20 | opt :drafts, 'Generate drafts' 21 | end 22 | 23 | branch = opts[:branch] 24 | branch_from = opts[:branch_from] 25 | config = File.expand_path(opts[:config]) 26 | fail 'branch can\'t be empty' if branch.empty? 27 | fail 'branch-from can\'t be empty' if branch_from.empty? 28 | fail 'config can\'t be empty' if config.empty? 29 | url = opts[:url] 30 | url = `git config --get remote.origin.url`.strip if url.empty? 31 | bundle = opts[:bundle] ? '"bundle exec"' : '""' 32 | drafts = opts[:drafts] ? '"--drafts"' : '""' 33 | 34 | spec = Gem::Specification.find_by_name('jgd') 35 | root = spec.gem_dir 36 | script = File.join(root, 'bash/deploy.sh') 37 | 38 | fail 'deployment failed, see log above' \ 39 | unless system("#{script} #{url} #{branch} #{branch_from} #{config} #{bundle} #{drafts}") 40 | -------------------------------------------------------------------------------- /jgd.gemspec: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # SPDX-FileCopyrightText: Copyright (c) 2014-2025 Yegor Bugayenko 4 | # SPDX-License-Identifier: MIT 5 | 6 | require 'English' 7 | 8 | Gem::Specification.new do |s| 9 | s.required_rubygems_version = Gem::Requirement.new('>= 0') if s.respond_to? :required_rubygems_version= 10 | s.required_ruby_version = '>= 2.3' 11 | s.name = 'jgd' 12 | s.version = '2.0.snapshot' 13 | s.license = 'MIT' 14 | s.summary = 'Jekyll Github Deploy' 15 | s.description = 'Automated deployment of your Jekyll blog to Github Pages' 16 | s.authors = ['Yegor Bugayenko'] 17 | s.email = 'yegor256@gmail.com' 18 | s.homepage = 'http://github.com/yegor256/jekyll-github-deploy' 19 | s.files = `git ls-files`.split($RS) 20 | s.executables = s.files.grep(%r{^bin/}) { |f| File.basename(f) } 21 | s.rdoc_options = ['--charset=UTF-8'] 22 | s.extra_rdoc_files = ['README.md', 'LICENSE.txt'] 23 | s.add_runtime_dependency('jekyll', '>=1') 24 | s.add_runtime_dependency('trollop', '>=2') 25 | s.metadata['rubygems_mfa_required'] = 'true' 26 | end 27 | -------------------------------------------------------------------------------- /logo.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Group 2 5 | Created with Sketch. 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | jgd 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /renovate.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://docs.renovatebot.com/renovate-schema.json", 3 | "extends": [ 4 | "config:base" 5 | ] 6 | } 7 | -------------------------------------------------------------------------------- /rubygems.yml.asc: -------------------------------------------------------------------------------- 1 | -----BEGIN PGP MESSAGE----- 2 | Version: GnuPG v1 3 | 4 | hQEMA5qETcGag5w6AQf/TW2FG4WyaxwHjfjMmlmhVTV5Ri231GWV72+WaViTdXzT 5 | D/F7axHvVMXWOhwkRaEt3ABn1ziHGIRzl7MZPPK+ZLO06xmKYAMpHYO3kUNmAoeG 6 | Hp7Ah+FIYSPeY+KAD72oLsn5+1q1uldeYhJXy813XsuuNGrwcqUBod4VgrjfeQQM 7 | uRcowvaBfXIvj8AzD+ZCSzrfM0ftffc+bNjcssNKqtnimoekRYIPElgt+VLuo2NP 8 | hMahSV7/GkQJ+wkbVrOkW6wlll+/yGVTqJTNgQ14DgI0g4+oYR6GpvF7exwmRsyt 9 | jquIGdi4ym76PfBjBbDN8MT18A2hEkMrcdT08Vig99LARwHEpfnUvQelQZu5XUfI 10 | JKB0VWvy2mc3piddqQQe7pXRDr0Qs0MoLwbTZ/s+YFxBC9shTNaIRSZTJ/onrQp1 11 | jxcwV3097lH+NSPbFALYET6JMrTGloBedGlMUaH1byGH2yFBQ1kLNpjvLPXtUSJF 12 | lH0182bq/jUT/e58L5yoSdDsefYD2nRiIK4r4+A1/Gu38Jthl+Wze0I1wZPXJWzo 13 | DISug4oATzds7h3Oljlb7ye/vlu7+ltiBHaPyFRD4LHXcQC+wnx1qxls8fQnNf4H 14 | kNDqLYJ7BUJhfrMbQsXp8wUL9DruXqQ81a0GeoAgu9qXhhpZCxLvjc5sv3UuRy5n 15 | bSwrMq6KYr+d 16 | =+Apj 17 | -----END PGP MESSAGE----- 18 | -------------------------------------------------------------------------------- /test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # SPDX-FileCopyrightText: Copyright (c) 2025 Yegor Bugayenko 4 | # SPDX-License-Identifier: MIT 5 | 6 | set -ex -o pipefail 7 | 8 | TMP=$(mktemp -d -t jgd-XXXX) 9 | 10 | CWD=$(pwd) 11 | git init "${TMP}" 12 | cd "${TMP}" 13 | echo "hello" > "test.html" 14 | git add "test.html" 15 | git config user.email "test@example.com" 16 | git config user.name "Test" 17 | git commit -am 'initial commit' 18 | cd "${CWD}" 19 | 20 | ./bash/deploy.sh "${TMP}" gh-pages master _some-other-config.yml 21 | 22 | cd "${TMP}" 23 | git checkout gh-pages 24 | ls -al 25 | grep "hello" < test.html 26 | cd "${CWD}" 27 | rm -rf "${TMP}" 28 | 29 | echo "success" 30 | --------------------------------------------------------------------------------