Skip to content

Commit

Permalink
Merge pull request typelevel#3855 from armanbilge/topic/publish-disco…
Browse files Browse the repository at this point in the history
…rd-announce

Post release to Discord in CI
  • Loading branch information
armanbilge authored Oct 4, 2023
2 parents edd7a13 + a7c6400 commit 40f6619
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 11 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -546,6 +546,11 @@ jobs:
SONATYPE_CREDENTIAL_HOST: ${{ secrets.SONATYPE_CREDENTIAL_HOST }}
run: sbt '++ ${{ matrix.scala }}' tlCiRelease

- name: Post release to Discord
env:
DISCORD_WEBHOOK_URL: ${{ secrets.DISCORD_WEBHOOK_URL }}
run: scripts/post-release-discord ${{ github.ref }}

dependency-submission:
name: Submit Dependencies
if: github.event_name != 'pull_request'
Expand Down
7 changes: 7 additions & 0 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,13 @@ ThisBuild / githubWorkflowBuild := Seq("JVM", "JS", "Native").map { platform =>
)
)

ThisBuild / githubWorkflowPublish +=
WorkflowStep.Run(
List("scripts/post-release-discord ${{ github.ref }}"),
name = Some("Post release to Discord"),
env = Map("DISCORD_WEBHOOK_URL" -> "${{ secrets.DISCORD_WEBHOOK_URL }}")
)

val ciVariants = CI.AllCIs.map(_.command)
val jsCiVariants = CI.AllJSCIs.map(_.command)
ThisBuild / githubWorkflowBuildMatrixAdditions += "ci" -> ciVariants
Expand Down
6 changes: 3 additions & 3 deletions scripts/make-release-prs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ cd "$(dirname $0)/.."
primary_base="$(pwd)"

if [[ $# -ne 2 ]] || [[ "$1" == "--help" ]]; then
echo "usage: $0 old-version new-version"
echo "usage: $0 old-tag new-tag"
exit 1
fi

old_version="$1"
new_version="$2"
old_version="${1#v}"
new_version="${2#v}"

minor_base=series/$(echo $new_version | sed -E 's/([0-9]+).([0-9]+).[0-9]+/\1.\2.x/')
major_base=series/$(echo $new_version | sed -E 's/([0-9]+).[0-9]+.[0-9]+/\1.x/')
Expand Down
6 changes: 3 additions & 3 deletions scripts/make-site-pr.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ cd "$(dirname $0)/.."
primary_base="$(pwd)"

if [[ $# -ne 2 ]] || [[ "$1" == "--help" ]]; then
echo "usage: $0 old-version new-version"
echo "usage: $0 old-tag new-tag"
exit 1
fi

old_version="$1"
new_version="$2"
old_version="${1#v}"
new_version="${2#v}"

cd "$(mktemp -d)"
gh repo clone typelevel/cats-effect
Expand Down
4 changes: 2 additions & 2 deletions scripts/post-release-discord.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ set -euo pipefail
IFS=$'\n\t'

if [[ $# -ne 1 ]] || [[ "$1" == "--help" ]]; then
echo "usage: $0 new-version"
echo "usage: $0 new-tag"
exit 1
fi

Expand All @@ -14,6 +14,6 @@ fi
#
# this url should be considered a secret and handled with appropriate care

data="{\"content\":\"https://github.com/typelevel/cats-effect/releases/tag/v$1\"}"
data="{\"content\":\"https://github.com/typelevel/cats-effect/releases/tag/$1\"}"

exec curl -H "Content-Type: application/json" -X POST -d "$data" "$DISCORD_WEBHOOK_URL"
6 changes: 3 additions & 3 deletions scripts/update-versions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ set -euo pipefail
IFS=$'\n\t'

if [[ $# -lt 2 ]] || [[ "$1" == "--help" ]]; then
echo "usage: $0 old-version new-version"
echo "usage: $0 old-tag new-tag"
exit 1
fi

Expand All @@ -16,8 +16,8 @@ else
cd "$(dirname $0)/.."
fi

old_version="$1"
new_version="$2"
old_version="${1#v}"
new_version="${2#v}"

# perl is ironically more portable than sed because of GNU/BSD differences
# the quote reduce the false positive rate
Expand Down

0 comments on commit 40f6619

Please sign in to comment.