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
Update automation #812
Merged
Merged
Update automation #812
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
9085ea5
Update automation
felipesu19 bbb55f2
remove bad file, other updates
felipesu19 faaabf3
Update script/release
felipesu19 2a4a405
Incorporate Feedback
felipesu19 59f0aa8
Merge branch 'release-updates' of github.com:github/pages-gem into re…
felipesu19 dc5a93a
Removed unneeded dependency
felipesu19 File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,4 +4,5 @@ | |
.sass-cache | ||
CNAME | ||
test-site/ | ||
vendor/ | ||
vendor/ | ||
tmp/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,9 @@ | ||
#!/bin/sh | ||
|
||
# check that gh is installed and logged in | ||
|
||
gh auth status -h github.com | ||
|
||
# Tag and push a release. | ||
|
||
set -e | ||
|
@@ -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" | ||
felipesu19 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
|
||
# 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' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What shell are you using? I thought you'd need backticks to execute commands and return their output. |
||
|
||
# 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/* |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since this is before the
set -e
, if it fails it won't stop the script from running.