Skip to content
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

Merged
merged 15 commits into from
Jan 31, 2021
Merged

feat: golang release #23

merged 15 commits into from
Jan 31, 2021

Conversation

iliapolo
Copy link
Contributor

@iliapolo iliapolo commented Jan 26, 2021

Publishes a directory that is expected to be the output of jsii-pacmak (i.e dist/go) to the appropriate GitHub repo.

bin/jsii-release-golang Outdated Show resolved Hide resolved
bin/jsii-release-golang Outdated Show resolved Hide resolved
@iliapolo iliapolo marked this pull request as draft January 26, 2021 13:10
@iliapolo iliapolo marked this pull request as ready for review January 31, 2021 13:28
@iliapolo iliapolo requested a review from eladb January 31, 2021 13:29
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}
Copy link
Contributor

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?

Copy link
Contributor Author

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}/* .
Copy link
Contributor

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?

Copy link
Contributor Author

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

@@ -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}
Copy link
Contributor Author

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.

@iliapolo iliapolo requested a review from eladb January 31, 2021 15:30
Copy link
Contributor

@eladb eladb left a 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}
Copy link
Contributor

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?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mergify mergify bot merged commit b36b8f9 into master Jan 31, 2021
@mergify mergify bot deleted the epolon/golang branch January 31, 2021 18:40
mergify bot pushed a commit to aws/jsii that referenced this pull request Feb 2, 2021
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants