This repository has been archived by the owner on Sep 2, 2019. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add ability to release via a magic tag
Not documentated yet. Leaving the previous release process code in place for now.
- Loading branch information
1 parent
c1410e6
commit 6b9745c
Showing
4 changed files
with
103 additions
and
4 deletions.
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 |
---|---|---|
@@ -0,0 +1,81 @@ | ||
#!/bin/bash | ||
|
||
set -o errexit | ||
set -o nounset | ||
|
||
USERNAME="{USERNAME}" | ||
REPO="{REPO}" | ||
GITHUB_USER="{GITHUB_USER}" | ||
|
||
# Who we are for git | ||
git config --global user.email "{COMMIT_EMAIL}" | ||
git config --global user.name "{COMMIT_NAME}" | ||
git config --global push.default simple | ||
|
||
TAG=$1 | ||
GITHUB_TOKEN=$2 | ||
# changes tag from "release-1.0.0" to "1.0.0" | ||
VERSION="${TAG/release-/}" | ||
|
||
### this doesn't account for master changing commit, assumes we are HEAD | ||
# or can otherwise push without issue. that shouldl error out without issue. | ||
# leaving us to restart from a different HEAD commit | ||
# update CHANGELOG | ||
changelog-tool release "${VERSION}" -e | ||
|
||
# commit CHANGELOG updates | ||
git add CHANGELOG.md | ||
git commit -m "Release ${VERSION}" | ||
|
||
# tag release | ||
git tag "${VERSION}" | ||
|
||
# push to release to remote | ||
git push origin master "${VERSION}" | ||
|
||
# update CHANGELOG for new entries | ||
changelog-tool unreleased -e | ||
|
||
# commit changelog and push to master | ||
git add CHANGELOG.md | ||
git commit -m "Add unreleased section to CHANGELOG post ${VERSION} release | ||
[skip ci]" | ||
git push origin master | ||
|
||
# release body | ||
echo "Preparing to update GitHub release notes..." | ||
|
||
body=$(changelog-tool get "${VERSION}") | ||
|
||
jsontemplate=" | ||
{ | ||
\"tag_name\":\$version, | ||
\"name\":\$version, | ||
\"body\":\$body | ||
} | ||
" | ||
|
||
json=$(jq -n \ | ||
--arg version "$VERSION" \ | ||
--arg body "$body" \ | ||
"${jsontemplate}") | ||
|
||
echo "Uploading release notes..." | ||
|
||
result=$(curl -X POST "https://api.github.com/repos/${USERNAME}/${REPO}/releases" \ | ||
-H "Content-Type: application/x-www-form-urlencoded" \ | ||
-u "${GITHUB_USER}:${GITHUB_TOKEN}" \ | ||
--data "${json}") | ||
|
||
rslt_scan=$(echo "${result}" | jq -r '.id') | ||
if [ "$rslt_scan" != null ] | ||
then | ||
echo "Release notes uploaded" | ||
else | ||
echo "Unable to upload release notes, here's the curl output..." | ||
echo "${result}" | ||
exit 1 | ||
fi | ||
|
||
|
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
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 |
---|---|---|
|
@@ -42,7 +42,7 @@ Additionally, the CONTRIBUTING.md assumes your project is hosted on GitHub and c | |
|
||
This repository is templated. You'll want to replace anything in {} with the correct value. The following replacement values are required: | ||
|
||
- {USERNAME}: your GitHub username, for example: `ponylang`. | ||
- {USERNAME}: your GitHub username or organization name, for example: `ponylang`. | ||
- {REPO}: the name of your repository, for example: `ponyc`. | ||
- {PACKAGE}: the name of your libraries package, for example: `msgpack`. | ||
- {COC_EMAIL}: email address that Code of Conduct violations should be reported to, for example: `[email protected]`. | ||
|
@@ -53,6 +53,7 @@ This repository is templated. You'll want to replace anything in {} with the cor | |
- {COMMIT_NAME}: Name to use for commits that code that is part of this package will create, for example: `ponylang-main`. | ||
- {COMMIT_EMAIL}: Email address to use for commits that code that is part of this package will create, for example: `[email protected]`. | ||
- {GITHUB_ACCESS_TOKEN_NAME}: Name of CircleCI environment variable that your GitHub personal access token that allows for `public_repo` access is stored in. | ||
- {GITHUB_USER}: Username for the owner of the GitHub access token | ||
|
||
## What you need to create | ||
|
||
|