diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index e5609c8c..80b0d2d1 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -7,7 +7,6 @@ jobs: strategy: matrix: ruby: - - 2.5 - 2.6 - 2.7 steps: diff --git a/.gitignore b/.gitignore index 3e7dd427..1b85dd91 100644 --- a/.gitignore +++ b/.gitignore @@ -4,4 +4,5 @@ .sass-cache CNAME test-site/ -vendor/ \ No newline at end of file +vendor/ +tmp/ \ No newline at end of file diff --git a/README.md b/README.md index b772c7e2..4187339b 100644 --- a/README.md +++ b/README.md @@ -113,6 +113,18 @@ See [all releases](https://github.com/github/pages-gem/releases). To release a new version of this gem, run `script/release` from the `master` branch. +This will create and tag the release. + +It will also create prs in the relevant repos and assign them to you. It is your responsibility to + +1. update the version of the gem in those repos +2. deploy those services as needed + +The relevant repos are: +1. [github-pages](https://github.com/github/pages) +2. [jekyll-build-pages](https://github.com/actions/jekyll-build-pages/blob/main/Gemfile) +3. [pages.github.com](https://github.com/github/pages.github.com) + ## License Distributed under the [MIT License](LICENSE). diff --git a/lib/github-pages/dependencies.rb b/lib/github-pages/dependencies.rb index ff5ded15..ecaad659 100644 --- a/lib/github-pages/dependencies.rb +++ b/lib/github-pages/dependencies.rb @@ -13,7 +13,7 @@ class Dependencies # Converters "kramdown" => "2.3.1", "kramdown-parser-gfm" => "1.1.0", - "jekyll-commonmark-ghpages" => "0.1.6", + "jekyll-commonmark-ghpages" => "0.2.0", # Misc "liquid" => "4.0.3", @@ -27,7 +27,7 @@ class Dependencies "jekyll-gist" => "1.5.0", "jekyll-paginate" => "1.1.0", "jekyll-coffeescript" => "1.1.1", - "jekyll-seo-tag" => "2.7.1", + "jekyll-seo-tag" => "2.8.0", "jekyll-github-metadata" => "2.13.0", "jekyll-avatar" => "0.7.0", "jekyll-remote-theme" => "0.4.3", diff --git a/lib/github-pages/version.rb b/lib/github-pages/version.rb index 690d7ef1..b40cc255 100644 --- a/lib/github-pages/version.rb +++ b/lib/github-pages/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module GitHubPages - VERSION = 223 + VERSION = 224 end diff --git a/script/release b/script/release index a67084b9..09310e6a 100755 --- a/script/release +++ b/script/release @@ -1,8 +1,13 @@ #!/bin/sh + # Tag and push a release. set -e +# check that gh is installed and logged in + +gh auth status -h github.com + # Make sure we're in the project root. cd $(dirname "$0")/.. @@ -39,4 +44,50 @@ git fetch -t origin # Tag it and bag it. gem push github-pages-*.gem && git tag "$tag" && - git push origin master && git push origin "$tag" +git push origin master && git push origin "$tag" + +# create a new release on github +gh release create "$tag" --notes "Automated release for $tag" + + +# create a tmp folder +mkdir -p tmp + +#for each dependent repo, create a new branch an a blank pr. +# first get the sha of main for each repo + +gh_pages_sha=`gh api repos/github/pages/git/refs/heads/master | jq '. | .object.sha'` +jekyll_sha=`gh api repos/actions/jekyll-build-pages/git/refs/heads/main | jq '. | .object.sha'` + +# then create the branches + +gh api repos/github/pages/git/refs -F "sha"="$gh_pages_sha" -F "ref"="refs/heads/pages-gem-release-$tag" +gh api repos/github/pages/git/refs -F "sha"="$jekyll_sha" -F "ref"="refs/heads/pages-gem-release-$tag" + +#then we need the tree object so we can create a commit using the api + +gh_pages_tree=`gh api repos/github/pages/git/commits/$gh_pages_sha | jq '. | .tree.sha'` +jekyll_tree=`gh api repos/github/actions/jekyll-build-pages/commits/$jekyll_sha | jq '. | .tree.sha'` + +# create the input file for the commit. We have to do this because the F flag doesn't support arrays + +echo "{\"tree\": \"$gh_pages_tree\", \"parents\": [\"$gh_pages_sha\"], \"message\": \"automated commit for pr creation\"}" > tmp/h_pages_commit_input.json +echo "{\"tree\": \"$jekyll_tree\", \"parents\": [\"$jekyll_sha\"], \"message\": \"automated commit for pr creation\"}" > tmp/jekyll_commit_input.json + +# create the commit + +new_gh_pages_sha=`gh api repos/github/pages/git/commits --input tmp/gh_pages_commit_input.json | jq '. | .sha'` +new_jekyll_sha=`gh api repos/actions/jekyll-build-pages/git/commits --input tmp/jekyll_commit_input.json | jq '. | .sha'` + +# associate the commit with the branch + +gh api repos/github/pages/git/refs/heads/pages-gem-release-$tag -F "sha"="$new_gh_pages_sha" -F "ref"="refs/heads/pages-gem-release-$tag" -F "force"="true" +gh api repos/actions/jekyll-build-pages/git/refs/heads/pages-gem-release-$tag -F "sha"="$new_jekyll_sha" -F "ref"="refs/heads/pages-gem-release-$tag" -F "force"="true" + +# create pull requests in downstream repos +gh pr create --base "master" --head "pages-gem-release-$tag" --title "Bump pages-gem version to $tag" --assignee "@me" --body "Bump pages-gem version to $tag. You must manually make those changes and commit to this branch" --repo "github/pages" +gh pr create --base "main" --head "pages-gem-release-$tag" --title "Bump pages-gem version to $tag" --assignee "@me" --body "Bump pages-gem version to $tag. You must manually make those changes and commit to this branch" --repo "actions/jekyll-build-pages" + +# clean up the input file for the commit + +rm tmp/*