generated from ponylang/library-project-starter
-
-
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.
- Loading branch information
1 parent
4ee312b
commit 3f81786
Showing
10 changed files
with
320 additions
and
177 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,89 @@ | ||
#!/bin/bash | ||
|
||
set -o errexit | ||
set -o nounset | ||
|
||
base=$(dirname "$0") | ||
source "${base}/env.bash" | ||
|
||
# Gather expected arguments. | ||
if [ $# -lt 2 ] | ||
then | ||
echo "Tag and GH personal access token are required" | ||
exit 1 | ||
fi | ||
|
||
# Directory we are going to do additional work in | ||
GEN_MD="$(mktemp -d)" | ||
|
||
# From command line | ||
TAG=$1 | ||
GITHUB_TOKEN=$2 | ||
|
||
# Shouldn't need to touch these | ||
BUILD_DIR="build/glob-docs" | ||
DOCS_DIR="${GEN_MD}/glob/${TAG}" | ||
|
||
# Generated markdown repo | ||
echo "Cloning main.actor-package-markdown repo into ${GEN_MD}" | ||
git clone \ | ||
"https://${GITHUB_TOKEN}@github.com/${REPO_OWNER}/main.actor-package-markdown.git" \ | ||
"${GEN_MD}" | ||
|
||
# Make the docs | ||
# We make assumptions about the location for the docs | ||
make docs | ||
|
||
# $BUILD_DIR contains the raw generated markdown for our documentation | ||
pushd "${BUILD_DIR}" || exit 1 | ||
mkdir -p "${DOCS_DIR}" | ||
cp -r docs/* "${DOCS_DIR}"/ | ||
cp -r mkdocs.yml "${DOCS_DIR}" | ||
|
||
# Upload any new documentation | ||
echo "Preparing to upload generated markdown content from ${GEN_MD}" | ||
echo "Git fiddling commences..." | ||
pushd "${GEN_MD}" || exit 1 | ||
echo "Creating a branch for generated documentation..." | ||
branch_name="glob-${TAG}" | ||
git checkout -b "${branch_name}" | ||
echo "Adding content..." | ||
git add . | ||
git commit -m "Add docs for package: glob version: ${TAG}" | ||
echo "Uploading new generated markdown content..." | ||
git push --set-upstream origin "${branch_name}" | ||
echo "Generated markdown content has been uploaded!" | ||
popd || exit 1 | ||
|
||
# Create a PR | ||
echo "Preparing to create a pull request..." | ||
jsontemplate=" | ||
{ | ||
\"title\":\$title, | ||
\"head\":\$incoming_repo_and_branch, | ||
\"base\":\"master\" | ||
} | ||
" | ||
|
||
json=$(jq -n \ | ||
--arg title "glob ${TAG}" \ | ||
--arg incoming_repo_and_branch "${REPO_OWNER}:${branch_name}" \ | ||
"${jsontemplate}") | ||
|
||
|
||
echo "Curling..." | ||
result=$(curl -X POST \ | ||
https://api.github.com/repos/ponylang/main.actor-package-markdown/pulls \ | ||
-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 "PR successfully created!" | ||
else | ||
echo "Unable to create PR, 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
REPO_OWNER="ponylang" | ||
REPO_NAME="glob" | ||
GITHUB_USER="ponylang-main" | ||
|
||
# Who we are for git | ||
git config --global user.email "ponylang.main@gmail.com" | ||
git config --global user.name "Main" | ||
git config --global push.default simple |
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,6 +1,7 @@ | ||
#!/bin/bash | ||
|
||
add-apt-repository ppa:ponylang/ponylang | ||
apt-get update | ||
apt-get install -y libpcre2-dev | ||
apt-get install -y pony-stable | ||
|
||
stable fetch |
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,135 @@ | ||
#!/bin/bash | ||
|
||
set -o errexit | ||
set -o nounset | ||
|
||
base=$(dirname "$0") | ||
source "${base}/env.bash" | ||
|
||
# Gather expected arguments. | ||
if [ $# -lt 3 ] | ||
then | ||
echo "Tag, GH personal access token, and Ponylang zulip access token are required" | ||
exit 1 | ||
fi | ||
|
||
TAG=$1 | ||
GITHUB_TOKEN=$2 | ||
ZULIP_TOKEN=$3 | ||
# 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 HEAD: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 HEAD: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/${REPO_OWNER}/${REPO_NAME}/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 | ||
|
||
# Update Last Week in Pony | ||
echo "Adding release to Last Week in Pony..." | ||
|
||
result=$(curl https://api.github.com/repos/ponylang/ponylang-website/issues?labels=last-week-in-pony) | ||
|
||
lwip_url=$(echo "${result}" | jq -r '.[].url') | ||
if [ "$lwip_url" != "" ] | ||
then | ||
body=" | ||
Version ${VERSION} of glob has been released. | ||
See the [release notes](https://github.com/ponylang/glob/releases/tag/${VERSION}) for more details. | ||
" | ||
|
||
jsontemplate=" | ||
{ | ||
\"body\":\$body | ||
} | ||
" | ||
|
||
json=$(jq -n \ | ||
--arg body "$body" \ | ||
"${jsontemplate}") | ||
|
||
result=$(curl -X POST "$lwip_url/comments" \ | ||
-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 notice posted to LWIP" | ||
else | ||
echo "Unable to post to LWIP, here's the curl output..." | ||
echo "${result}" | ||
fi | ||
else | ||
echo "Unable to post to Last Week in Pony. Can't find the issue." | ||
fi | ||
|
||
message=" | ||
Version ${VERSION} of glob has been released. | ||
See the [release notes](https://github.com/ponylang/glob/releases/tag/${VERSION}) for more details. | ||
" | ||
|
||
curl -X POST https://ponylang.zulipchat.com/api/v1/messages \ | ||
-u ${ZULIP_TOKEN} \ | ||
-d "type=stream" \ | ||
-d "to=announce" \ | ||
-d "topic=glob" \ | ||
-d "content=${message}" |
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
Oops, something went wrong.