summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJosé Valim <jose.valim@dashbit.co>2021-12-30 16:42:39 +0100
committerJosé Valim <jose.valim@dashbit.co>2021-12-30 16:42:39 +0100
commit43aa30d26395fa35db295843c640947d5bf82ea3 (patch)
treedcf3599cceb55a40f5bdd5ce5f053128ecadf9ea
parentea632b6c56fb376f8f275adf37ab20a2fbc38283 (diff)
downloadelixir-43aa30d26395fa35db295843c640947d5bf82ea3.tar.gz
Automate notifications
-rw-r--r--.github/workflows/mail.exs21
-rw-r--r--.github/workflows/notify.exs61
-rw-r--r--.github/workflows/notify.yml25
-rw-r--r--.github/workflows/release.yml1
-rw-r--r--RELEASE.md4
-rw-r--r--SECURITY.md2
6 files changed, 89 insertions, 25 deletions
diff --git a/.github/workflows/mail.exs b/.github/workflows/mail.exs
deleted file mode 100644
index b78d447c7..000000000
--- a/.github/workflows/mail.exs
+++ /dev/null
@@ -1,21 +0,0 @@
-# #!/usr/bin/env elixir
-[tag] = System.argv()
-Mix.install([:req, :jason])
-
-%{status: 200, body: body} =
- Req.get!("https://api.github.com/repos/elixir-lang/elixir/releases/tags/#{tag}")
-
-names_and_checksums =
- for asset <- body["assets"],
- name = asset["name"],
- name =~ ~r/.sha\d+sum$/,
- do: {name, Req.get!(asset["browser_download_url"]).body}
-
-IO.puts("https://github.com/elixir-lang/elixir/releases/tag/#{tag}")
-IO.puts("")
-
-for {name, checksum} <- Enum.sort(names_and_checksums) do
- root = Path.rootname(name)
- "." <> type = Path.extname(name)
- IO.puts(" * #{root} - #{type} - #{checksum}")
-end
diff --git a/.github/workflows/notify.exs b/.github/workflows/notify.exs
new file mode 100644
index 000000000..6e3efe2e8
--- /dev/null
+++ b/.github/workflows/notify.exs
@@ -0,0 +1,61 @@
+# #!/usr/bin/env elixir
+[tag] = System.argv()
+
+Mix.install([
+ {:req, "~> 0.2.1"},
+ {:jason, "~> 1.0"}
+])
+
+%{status: 200, body: body} =
+ Req.get!("https://api.github.com/repos/elixir-lang/elixir/releases/tags/#{tag}")
+
+if body["draft"] do
+ raise "cannot notify a draft release"
+end
+
+## Notify on elixir-lang-ann
+
+names_and_checksums =
+ for asset <- body["assets"],
+ name = asset["name"],
+ name =~ ~r/.sha\d+sum$/,
+ do: {name, Req.get!(asset["browser_download_url"]).body}
+
+line_items =
+ for {name, checksum} <- Enum.sort(names_and_checksums) do
+ root = Path.rootname(name)
+ "." <> type = Path.extname(name)
+ " * #{root} - #{type} - #{checksum}\n"
+ end
+
+headers = %{
+ "X-Postmark-Server-Token" => System.fetch_env!("ELIXIR_LANG_ANN_TOKEN")
+}
+
+body = %{
+ "From" => "jose.valim@dashbit.co",
+ "To" => "elixir-lang-ann@googlegroups.com",
+ "Subject" => "Elixir #{tag} released",
+ "HtmlBody" => "https://github.com/elixir-lang/elixir/releases/tag/#{tag}\n\n#{line_items}",
+ "MessageStream": "outbound"
+}
+
+resp = Req.post!("https://api.postmarkapp.com/email", {:json, body}, headers: headers)
+IO.puts("#{resp.status} elixir-lang-ann\n#{inspect(resp.body)}")
+
+## Notify on Elixir Forum
+
+headers = %{
+ "api-key" => System.fetch_env!("ELIXIR_FORUM_TOKEN"),
+ "api-username" => "Elixir"
+}
+
+body = %{
+ "title" => "Elixir #{tag} released",
+ "raw" => "https://github.com/elixir-lang/elixir/releases/tag/#{tag}\n\n#{body["body"]}",
+ # Elixir News
+ "category" => 28
+}
+
+resp = Req.post!("https://elixirforum.com/posts.json", {:json, body}, headers: headers))
+IO.puts("#{resp.status} Elixir Forum\n#{inspect(resp.body)}")
diff --git a/.github/workflows/notify.yml b/.github/workflows/notify.yml
new file mode 100644
index 000000000..58520f3ee
--- /dev/null
+++ b/.github/workflows/notify.yml
@@ -0,0 +1,25 @@
+name: Notify
+
+on:
+ release:
+ types:
+ - published
+
+jobs:
+ notify:
+ runs-on: ubuntu-latest
+ name: Notify
+ steps:
+ - uses: actions/checkout@v2
+ with:
+ fetch-depth: 50
+ - uses: erlef/setup-beam@v1
+ with:
+ otp-version: 24.2
+ elixir-version: 1.13.1
+ - name: Run Elixir script
+ env:
+ ELIXIR_FORUM_TOKEN: ${{ secret.ELIXIR_FORUM_TOKEN }}
+ ELIXIR_LANG_ANN_TOKEN: ${{ secret.ELIXIR_LANG_ANN_TOKEN }}
+ run: |
+ elixir .github./workflows/notify.exs ${{ github.ref_name }}
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index 24f2c958a..e4e0c3515 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -1,4 +1,5 @@
name: Release
+
on:
push:
tags:
diff --git a/RELEASE.md b/RELEASE.md
index 184881e46..2bb7736f7 100644
--- a/RELEASE.md
+++ b/RELEASE.md
@@ -12,14 +12,12 @@
5. Commit changes above with title "Release vVERSION", generate a new tag, and push it
-6. Wait until GitHub Actions publish artifacts to the given tag and the CI is green
+6. Wait until GitHub Actions publish artifacts to the draft release and the CI is green
7. Copy the relevant bits from /CHANGELOG.md to the GitHub release and publish it
8. Add the release to `elixir.csv` with the minimum supported OTP version (all releases), update `erlang.csv` to the latest supported OTP version, and `_data/elixir-versions.yml` (except for RCs) files in `elixir-lang/elixir-lang.github.com`
-9. Send an e-mail to elixir-lang-ann@googlegroups.com with title "Elixir vVERSION released". Use `.github/workflows/mail.exs TAG` to generate the body of the email
-
## Creating a new vMAJOR.MINOR branch
### In the new branch
diff --git a/SECURITY.md b/SECURITY.md
index e0fe81c6c..128bcd458 100644
--- a/SECURITY.md
+++ b/SECURITY.md
@@ -17,7 +17,7 @@ Elixir version | Support
New releases are announced in the read-only [announcements mailing list](https://groups.google.com/group/elixir-lang-ann). You can subscribe by sending an email to elixir-lang-ann+subscribe@googlegroups.com and replying to the confirmation email.
-All security releases [will be tagged with `[security]`](https://groups.google.com/forum/#!searchin/elixir-lang-ann/%5Bsecurity%5D%7Csort:date).
+Security notifications [will be tagged with `[security]`](https://groups.google.com/forum/#!searchin/elixir-lang-ann/%5Bsecurity%5D%7Csort:date).
## Reporting a vulnerability