-
Notifications
You must be signed in to change notification settings - Fork 22
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
feat: golang release #23
Conversation
target_repo_dir=$(mktemp -d)/repo | ||
|
||
echo "Cloning target repository ${GITHUB_REPO}" | ||
git clone https://${GITHUB_TOKEN}@github.com/${GITHUB_REPO}.git ${target_repo_dir} |
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.
Can we do depth=1 here?
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.
If we push to a branch other than main
, and that branch is more than 1 commits behind main
, the branch won't be fetched, which will cause the script to incorrectly create it.
git checkout -B ${GIT_BRANCH} | ||
|
||
echo "Copying go module to repository root" | ||
cp -r ${dir}/* . |
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.
How does this handle deleted files?
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.
Good point. It doesn't. I'll fix.
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.
Fixed
bin/jsii-release-golang
Outdated
@@ -122,10 +122,19 @@ pushd ${target_repo_dir} | |||
git config user.name ${GIT_USER_NAME} | |||
git config user.email ${GIT_USER_EMAIL} | |||
|
|||
# -B to create if it doesn't exist, reset otherwise | |||
git checkout -B ${GIT_BRANCH} |
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.
This didn't do what I thought it did, and always created a new branch even if git checkout
would work.
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.
One last question
if $dry_run; then | ||
echo "Will create a tag: ${tag_name}" | ||
else | ||
git push origin ${tag_name} |
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.
Do we also need to push to the branch?
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.
You mean should we skip pushing to the branch?
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 golang version isn't available anywhere inside the module, we embed a version file so that consumers can access the version. This is needed for publishing [go modules](cdklabs/publib#23) using `jsii-release` without the user having to supply the version externally. --- By submitting this pull request, I confirm that my contribution is made under the terms of the [Apache 2.0 license]. [Apache 2.0 license]: https://www.apache.org/licenses/LICENSE-2.0
Publishes a directory that is expected to be the output of
jsii-pacmak
(i.edist/go
) to the appropriate GitHub repo.