Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 37 additions & 4 deletions .github/workflows/autobump.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@ jobs:

bin/update-ruby-recipe "$latest" "$tarball_url" "$sha256"
bin/validate-recipes
if ! git diff --quiet -- recipes/rubies.yml; then
git add recipes/rubies.yml
if ! git diff --quiet -- recipes/rubies.yml recipes/series.yml; then
git add recipes/rubies.yml recipes/series.yml
git commit -m "Add Ruby ${latest}"
fi
done
Expand Down Expand Up @@ -121,8 +121,8 @@ jobs:

bin/update-ruby-recipe "$version" "$tarball_url" "$sha256"
bin/validate-recipes
if ! git diff --quiet -- recipes/rubies.yml; then
git add recipes/rubies.yml
if ! git diff --quiet -- recipes/rubies.yml recipes/series.yml; then
git add recipes/rubies.yml recipes/series.yml
git commit -m "Add Ruby ${version}"
fi
done
Expand All @@ -134,3 +134,36 @@ jobs:
else
echo "No recipe changes to push"
fi

notify-failure:
needs: autobump
if: ${{ failure() }}
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- name: Send failure email via Resend
env:
RESEND_API_KEY: ${{ secrets.RESEND_API_KEY }}
NOTIFY_EMAIL: ${{ secrets.NOTIFY_EMAIL }}
RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
run: |
set -euo pipefail
if [ -z "${RESEND_API_KEY:-}" ] || [ -z "${NOTIFY_EMAIL:-}" ]; then
echo "::warning::RESEND_API_KEY or NOTIFY_EMAIL is unset; skipping autobump failure notification"
exit 0
fi
payload=$(jq -n \
--arg to "$NOTIFY_EMAIL" \
--arg run_url "$RUN_URL" \
'{
from: "Ruby Releases <ruby@en.dev>",
to: [$to],
subject: "❌ Ruby autobump failed",
html: ("<p>The autobump workflow failed, so new Ruby releases are not being picked up.</p><p><a href=\"\($run_url | @html)\">View workflow run</a></p>")
}')
curl --fail-with-body -sS \
--retry 3 --retry-all-errors --retry-delay 2 --retry-max-time 60 \
-X POST 'https://api.resend.com/emails' \
-H "Authorization: Bearer ${RESEND_API_KEY}" \
-H 'Content-Type: application/json' \
-d "$payload"
12 changes: 12 additions & 0 deletions libexec/update_ruby_recipe.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ class UpdateRubyRecipeError < StandardError; end
class UpdateRubyRecipe
ROOT = File.expand_path("..", __dir__)
RECIPE_PATH = File.join(ROOT, "recipes", "rubies.yml")
SERIES_PATH = File.join(ROOT, "recipes", "series.yml")
PRE_RELEASE_RANK = {
"preview" => 0,
"rc" => 1
Expand All @@ -34,6 +35,7 @@ def run!
rubies = doc.fetch("rubies")
old = rubies[@version]
entry = recipe_entry
register_series(entry.fetch("series"))
if old == entry
puts "Ruby #{@version} already exists in recipes/rubies.yml"
return
Expand All @@ -46,6 +48,16 @@ def run!

private

# A new minor series has no overrides yet, so it gets the defaults.
def register_series(name)
text = File.read(SERIES_PATH)
doc = YAML.safe_load(text, permitted_classes: [], aliases: false)
return if doc.fetch("series").key?(name)

File.write(SERIES_PATH, "#{text.chomp}\n \"#{name}\": {}\n")
puts "Added series #{name} in recipes/series.yml"
end

def recipe_entry
entry = {
"series" => @version[/\A\d+\.\d+/],
Expand Down
Loading