Skip to content

Commit aca66e1

Browse files
committed
Add automated Ruby version detection and publishing workflows
Implements end-to-end automation for detecting new Ruby versions from rbenv/ruby-build and publishing features/images with approval gates. Key Features: - Daily check for new Ruby versions (>= 3.2.0 non-EOL only) - Automatic PR creation with auto-merge on CI success - Conditional publishing: full rebuild on feature bump, incremental otherwise - Single approval gate for all publishing operations - Comprehensive workflow annotations and failure notifications Workflows: - check-ruby-versions.yaml: Daily cron + manual trigger for detection - publish-ruby-updates.yaml: Handles feature/image publishing with approval - Modified release-features.yaml: Excludes Ruby feature from batch publish - Modified publish-new-image-version.yaml: Uses dynamic matrix from JSON Scripts: - find-new-ruby-versions: Fetches and filters versions from ruby-build - check-and-create-pr: Orchestrates detection and PR creation - create-ruby-versions-pr: Creates formatted PR with automation labels - check-feature-bump: Detects feature version changes in commits - extract-new-ruby-versions: Parses new versions from git diff - get-current-image-version: Gets latest ruby-* tag - Modified add-ruby-version: Uses JSON storage instead of YAML Infrastructure: - .github/ruby-versions.json: Single source of truth for version matrix - Uses RUBY_AUTOMATION_PAT for proper workflow triggering - Proper stdout/stderr separation for script composition - yq installed in devcontainer for JSON/YAML manipulation Workflow Behavior: - Feature bump: Publish feature → create release → tag → build all versions - No bump: Trigger builds for new Ruby versions only - Approval step shows summary of what will be published - Failure notifications create GitHub issues automatically
1 parent 13fc03b commit aca66e1

13 files changed

+644
-104
lines changed

.devcontainer/Dockerfile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
11
FROM mcr.microsoft.com/devcontainers/javascript-node:1-20-bookworm
22

33
RUN apt-get update && apt-get install -y shellcheck
4+
5+
# Install yq for YAML processing
6+
RUN ARCH=$(dpkg --print-architecture) && \
7+
wget -qO /usr/local/bin/yq "https://github.com/mikefarah/yq/releases/latest/download/yq_linux_${ARCH}" && \
8+
chmod +x /usr/local/bin/yq

.github/ruby-versions.json

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
[
2+
"4.0.0",
3+
"3.4.8",
4+
"3.4.7",
5+
"3.4.6",
6+
"3.4.5",
7+
"3.4.4",
8+
"3.4.3",
9+
"3.4.2",
10+
"3.4.1",
11+
"3.4.0",
12+
"3.3.10",
13+
"3.3.9",
14+
"3.3.8",
15+
"3.3.7",
16+
"3.3.6",
17+
"3.3.5",
18+
"3.3.4",
19+
"3.3.3",
20+
"3.3.2",
21+
"3.3.1",
22+
"3.3.0",
23+
"3.2.9",
24+
"3.2.8",
25+
"3.2.7",
26+
"3.2.6",
27+
"3.2.5",
28+
"3.2.4",
29+
"3.2.3",
30+
"3.2.2",
31+
"3.2.1",
32+
"3.2.0"
33+
]
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
name: Check for New Ruby Versions
2+
3+
on:
4+
schedule:
5+
- cron: '0 2 * * *' # Daily at 2 AM UTC
6+
workflow_dispatch: # Allow manual triggers
7+
8+
permissions:
9+
contents: write
10+
pull-requests: write
11+
issues: write
12+
13+
jobs:
14+
check-versions:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- name: Checkout repository
18+
uses: actions/checkout@v4
19+
20+
- name: Setup Node.js
21+
uses: actions/setup-node@v4
22+
with:
23+
node-version: '20'
24+
25+
- name: Install dependencies
26+
run: npm ci
27+
28+
- name: Check for new versions and create PR
29+
id: check-and-create
30+
env:
31+
GH_TOKEN: ${{ secrets.RUBY_AUTOMATION_PAT }}
32+
run: |
33+
PR_NUMBER=$(bin/check-and-create-pr "${{ secrets.RUBY_AUTOMATION_PAT }}")
34+
35+
if [ -n "$PR_NUMBER" ]; then
36+
echo "pr_number=$PR_NUMBER" >> $GITHUB_OUTPUT
37+
fi
38+
39+
- name: Enable auto-merge
40+
if: steps.check-and-create.outputs.pr_number != ''
41+
env:
42+
GH_TOKEN: ${{ secrets.RUBY_AUTOMATION_PAT }}
43+
run: |
44+
echo "Enabling auto-merge for PR #${{ steps.check-and-create.outputs.pr_number }}..."
45+
gh pr merge ${{ steps.check-and-create.outputs.pr_number }} --auto --squash
46+
47+
- name: Create issue on failure
48+
if: failure()
49+
uses: actions/github-script@v7
50+
with:
51+
script: |
52+
await github.rest.issues.create({
53+
owner: context.repo.owner,
54+
repo: context.repo.repo,
55+
title: '🔴 Ruby Version Check Failed',
56+
body: `The automated Ruby version check workflow failed.
57+
58+
**Run:** ${context.serverUrl}/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}
59+
60+
**Job:** ${context.job}
61+
62+
Please check the workflow logs for details.`,
63+
labels: ['automation', 'bug', 'ruby-versions']
64+
});

.github/workflows/publish-new-image-version.yaml

Lines changed: 11 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -4,43 +4,22 @@ name: Build and Publish Images
44
tags:
55
- ruby-*.*.*
66
jobs:
7+
setup:
8+
runs-on: ubuntu-latest
9+
outputs:
10+
matrix: ${{ steps.set-matrix.outputs.matrix }}
11+
steps:
12+
- uses: actions/checkout@v4
13+
- id: set-matrix
14+
run: echo "matrix=$(cat .github/ruby-versions.json | jq -c '.')" >> $GITHUB_OUTPUT
15+
716
build:
817
name: Build Images
18+
needs: setup
919
strategy:
1020
fail-fast: false
1121
matrix:
12-
RUBY_VERSION:
13-
- 4.0.0
14-
- 3.4.8
15-
- 3.4.7
16-
- 3.4.6
17-
- 3.4.5
18-
- 3.4.4
19-
- 3.4.3
20-
- 3.4.2
21-
- 3.4.1
22-
- 3.4.0
23-
- 3.3.10
24-
- 3.3.9
25-
- 3.3.8
26-
- 3.3.7
27-
- 3.3.6
28-
- 3.3.5
29-
- 3.3.4
30-
- 3.3.3
31-
- 3.3.2
32-
- 3.3.1
33-
- 3.3.0
34-
- 3.2.9
35-
- 3.2.8
36-
- 3.2.7
37-
- 3.2.6
38-
- 3.2.5
39-
- 3.2.4
40-
- 3.2.3
41-
- 3.2.2
42-
- 3.2.1
43-
- 3.2.0
22+
RUBY_VERSION: ${{ fromJSON(needs.setup.outputs.matrix) }}
4423
runs-on: ubuntu-latest
4524
permissions:
4625
contents: read

0 commit comments

Comments
 (0)