Skip to content

Commit c79b176

Browse files
committed
Enable release and publishing workflows. Update Redis version to 8.8.0
1 parent b8f1500 commit c79b176

16 files changed

Lines changed: 594 additions & 148 deletions

File tree

.github/.env

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
BUILD_TARGETS=[{"os":"linux","arch":"amd64","runner":"ubuntu-latest"},{"os":"linux","arch":"arm64","runner":"ubuntu-24.04-arm"},{"os":"darwin","arch":"amd64","runner":"macos-14-large"},{"os":"darwin","arch":"arm64","runner":"macos-14-xlarge"}]
2+
SMOKE_TEST_ARCHES=[{"arch":"amd64","runner":"ubuntu-latest"},{"arch":"arm64","runner":"ubuntu-24.04-arm"}]

.github/actions/common/slack.sh

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
#!/bin/bash
2+
# Slack message builders for release notifications: a success message with the
3+
# install command, or a failure message with the reason.
4+
5+
slack_format_success_message() {
6+
# $1 release_tag $2 base_url (…/redis-cli) $3 env $4 footer
7+
jq -n --arg tag "$1" --arg base "$2" --arg env "$3" --arg footer "$4" '
8+
{
9+
"icon_emoji": ":redis-circle:",
10+
"text": (":redis-circle: redis-cli " + $tag + " published (" + $env + ")"),
11+
"blocks": [
12+
{ "type": "header",
13+
"text": { "type": "plain_text", "text": ("redis-cli " + $tag + " published (" + $env + ")") } },
14+
{ "type": "section",
15+
"text": { "type": "mrkdwn",
16+
"text": ("Install:\n```curl -fsSL " + $base + "/install.sh | REDIS_CLI_VERSION=" + $tag + " sh```") } },
17+
{ "type": "context", "elements": [ { "type": "mrkdwn", "text": $footer } ] }
18+
]
19+
}'
20+
}
21+
22+
slack_format_failure_message() {
23+
# $1 release_tag $2 message $3 env $4 footer
24+
jq -n --arg tag "$1" --arg msg "$2" --arg env "$3" --arg footer "$4" '
25+
{
26+
"icon_emoji": ":redis-circle:",
27+
"text": (":x: redis-cli " + $tag + " release failed (" + $env + ")"),
28+
"blocks": [
29+
{ "type": "header",
30+
"text": { "type": "plain_text", "text": ("redis-cli " + $tag + " release failed (" + $env + ")") } },
31+
{ "type": "section", "text": { "type": "mrkdwn", "text": $msg } },
32+
{ "type": "context", "elements": [ { "type": "mrkdwn", "text": $footer } ] }
33+
]
34+
}'
35+
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: "Parse env file"
2+
description: "Parses the .github/.env build-matrix file and exposes its keys as outputs"
3+
4+
inputs:
5+
env_file_path:
6+
description: ".env file path"
7+
default: '.github/.env'
8+
required: false
9+
10+
outputs:
11+
BUILD_TARGETS:
12+
description: "JSON array of build targets ({os,arch,runner})"
13+
value: ${{ steps.parse.outputs.BUILD_TARGETS }}
14+
SMOKE_TEST_ARCHES:
15+
description: "JSON array of arches to smoke-test the published artifacts on"
16+
value: ${{ steps.parse.outputs.SMOKE_TEST_ARCHES }}
17+
18+
runs:
19+
using: "composite"
20+
steps:
21+
- name: Parse env file
22+
id: parse
23+
shell: bash
24+
run: |
25+
while IFS= read -r line || [[ -n "$line" ]]; do
26+
[[ -z "$line" || "$line" =~ ^# ]] && continue
27+
echo "$line" >> "$GITHUB_OUTPUT"
28+
done < "${{ inputs.env_file_path }}"
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: "Parse release handle"
2+
description: "Parses a release_handle JSON input and extracts all available fields as outputs"
3+
4+
inputs:
5+
release_handle:
6+
description: "JSON string containing release handle information"
7+
required: true
8+
9+
outputs:
10+
run_id:
11+
description: "The extracted run_id from the release_handle"
12+
value: ${{ steps.parse.outputs.run_id }}
13+
release_tag:
14+
description: "The extracted release_tag from the release_handle"
15+
value: ${{ steps.parse.outputs.release_tag }}
16+
workflow_uuid:
17+
description: "The extracted workflow_uuid from the release_handle"
18+
value: ${{ steps.parse.outputs.workflow_uuid }}
19+
release_type:
20+
description: "The extracted release_type from the release_handle"
21+
value: ${{ steps.parse.outputs.release_type }}
22+
23+
runs:
24+
using: "composite"
25+
steps:
26+
- name: Parse release handle
27+
id: parse
28+
shell: bash
29+
run: |
30+
release_handle='${{ inputs.release_handle }}'
31+
32+
if ! echo "$release_handle" | jq . >/dev/null 2>&1; then
33+
echo "Error: release_handle is not valid JSON"
34+
echo "Release handle content: $release_handle"
35+
exit 1
36+
fi
37+
38+
run_id=$(echo "$release_handle" | jq -r '.run_id // empty')
39+
release_tag=$(echo "$release_handle" | jq -r '.release_tag // empty')
40+
workflow_uuid=$(echo "$release_handle" | jq -r '.workflow_uuid // empty')
41+
release_type=$(echo "$release_handle" | jq -r '.release_type // empty')
42+
43+
if [ -z "$run_id" ] || ! [[ "$run_id" =~ ^[0-9]+$ ]]; then
44+
echo "Error: run_id missing/invalid in release_handle: '$run_id'"
45+
exit 1
46+
fi
47+
48+
echo "run_id=$run_id" >> "$GITHUB_OUTPUT"
49+
[ -n "$release_tag" ] && echo "release_tag=$release_tag" >> "$GITHUB_OUTPUT"
50+
[ -n "$workflow_uuid" ] && echo "workflow_uuid=$workflow_uuid" >> "$GITHUB_OUTPUT"
51+
[ -n "$release_type" ] && echo "release_type=$release_type" >> "$GITHUB_OUTPUT"
52+
echo "Parsed handle: run_id=$run_id release_tag=$release_tag release_type=$release_type"
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: "Run smoke tests"
2+
description: "Install the published redis-cli across many distros and verify it runs (via test-distros.sh)"
3+
4+
inputs:
5+
arch:
6+
description: "Architecture to smoke-test (amd64 | arch of the runner)"
7+
required: true
8+
version:
9+
description: "Version to install and verify"
10+
required: true
11+
base_url:
12+
description: "Base URL the installer downloads from (…/redis-cli)"
13+
required: true
14+
15+
runs:
16+
using: "composite"
17+
steps:
18+
- name: Smoke test published artifacts across distros
19+
shell: bash
20+
env:
21+
REDIS_CLI_BASE_URL: ${{ inputs.base_url }}
22+
run: ./test-distros.sh --arch ${{ inputs.arch }} --version "${{ inputs.version }}"
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: "Slack notification"
2+
description: "Send a redis-cli release Slack notification (no-op if the webhook secret is unset)"
3+
4+
inputs:
5+
slack_func:
6+
description: "slack_format_success_message | slack_format_failure_message"
7+
required: true
8+
release_tag:
9+
description: "Release tag"
10+
required: true
11+
env:
12+
description: "Target environment (production | staging)"
13+
required: true
14+
base_url:
15+
description: "Base URL (…/redis-cli), for the success message install line"
16+
required: false
17+
default: ""
18+
message:
19+
description: "Failure message"
20+
required: false
21+
default: ""
22+
SLACK_WEB_HOOK_URL:
23+
description: "Slack webhook URL (if empty, this action does nothing)"
24+
required: false
25+
default: ""
26+
27+
runs:
28+
using: "composite"
29+
steps:
30+
- name: Send Slack notification
31+
if: inputs.SLACK_WEB_HOOK_URL != ''
32+
shell: bash
33+
run: |
34+
. "${{ github.action_path }}/../common/slack.sh"
35+
workflow_url="https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}"
36+
footer="Repo: ${{ github.repository }} | Commit: \`${{ github.sha }}\` | <$workflow_url|workflow run>"
37+
38+
if [ "${{ inputs.slack_func }}" = "slack_format_success_message" ]; then
39+
payload="$(slack_format_success_message "${{ inputs.release_tag }}" "${{ inputs.base_url }}" "${{ inputs.env }}" "$footer")"
40+
else
41+
msg="${{ inputs.message }}"
42+
[ -n "$msg" ] || msg=":x: redis-cli release failed"
43+
payload="$(slack_format_failure_message "${{ inputs.release_tag }}" "$msg" "${{ inputs.env }}" "$footer")"
44+
fi
45+
printf '%s' "$payload" | curl -s --fail-with-body -d @- "${{ inputs.SLACK_WEB_HOOK_URL }}"
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
name: "Update Redis version"
2+
description: >
3+
Pin the Redis source for a release line: write .redis_version and update
4+
build.sh's PINNED_REF and PINNED_SHA256 to the tag, then commit to the release
5+
version branch. Keeps source verification active for the new version.
6+
7+
inputs:
8+
release_tag:
9+
description: "Release tag to pin (e.g. 8.8.0); 'unstable' is skipped"
10+
required: true
11+
release_version_branch:
12+
description: "Branch to commit the pin to"
13+
required: true
14+
gh_token:
15+
description: "GitHub token"
16+
required: true
17+
18+
outputs:
19+
changed_files:
20+
description: "Newline-separated files that were modified (empty if none)"
21+
value: ${{ steps.repin.outputs.changed_files }}
22+
23+
runs:
24+
using: "composite"
25+
steps:
26+
- name: Re-pin Redis source
27+
id: repin
28+
shell: bash
29+
run: |
30+
TAG="${{ inputs.release_tag }}"
31+
if [ "$TAG" = "unstable" ] || [ -z "$TAG" ]; then
32+
echo "Skipping pin for '$TAG'"
33+
echo "changed_files=" >> "$GITHUB_OUTPUT"
34+
exit 0
35+
fi
36+
37+
echo "$TAG" > .redis_version
38+
39+
tmp="$(mktemp)"
40+
curl -fsSL "https://github.com/redis/redis/archive/${TAG}.tar.gz" -o "$tmp"
41+
sha="$(sha256sum "$tmp" | awk '{print $1}')"
42+
rm -f "$tmp"
43+
echo "Computed source SHA-256 for $TAG: $sha"
44+
45+
sed -i -E "s|^PINNED_REF=.*|PINNED_REF=\"${TAG}\"|" build.sh
46+
sed -i -E "s|^PINNED_SHA256=.*|PINNED_SHA256=\"${sha}\"|" build.sh
47+
48+
if git diff --quiet .redis_version build.sh; then
49+
echo "No version/pin changes"
50+
echo "changed_files=" >> "$GITHUB_OUTPUT"
51+
else
52+
{
53+
echo "changed_files<<EOF"
54+
echo ".redis_version"
55+
echo "build.sh"
56+
echo "EOF"
57+
} >> "$GITHUB_OUTPUT"
58+
fi
59+
60+
- name: Create verified commit
61+
if: steps.repin.outputs.changed_files != ''
62+
uses: iarekylew00t/verified-bot-commit@v1
63+
with:
64+
message: "Pin redis-cli source to ${{ inputs.release_tag }}"
65+
files: ${{ steps.repin.outputs.changed_files }}
66+
ref: ${{ inputs.release_version_branch }}
Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,42 @@
11
name: Build and Test
22

3-
# Reusable workflow: builds statically linked redis-cli for all four targets
4-
# (linux/macos x amd64/arm64), smoke-tests each, and uploads them as run
5-
# artifacts. Called by release_build_and_test.yml and release_publish.yml.
6-
73
on:
84
workflow_call:
95
inputs:
106
release_tag:
11-
description: 'Redis version/tag to build (e.g. 8.4.4) or "unstable"'
7+
description: 'Redis version/tag to build (e.g. 8.8.0) or "unstable"'
8+
required: true
9+
type: string
10+
build_targets:
11+
description: 'JSON array of {os,arch,runner} (from .github/.env)'
1212
required: true
1313
type: string
14+
checkout_ref:
15+
description: 'Ref to build (e.g. the release version branch); default = triggering ref'
16+
required: false
17+
type: string
18+
default: ''
1419

1520
jobs:
1621
build:
1722
strategy:
1823
fail-fast: false
1924
matrix:
20-
include:
21-
- { os: linux, arch: amd64, runner: ubuntu-latest }
22-
- { os: linux, arch: arm64, runner: ubuntu-24.04-arm }
23-
- { os: darwin, arch: amd64, runner: macos-14-large } # macOS 14 x86_64
24-
- { os: darwin, arch: arm64, runner: macos-14-xlarge } # macOS 14 arm64
25+
include: ${{ fromJSON(inputs.build_targets) }}
2526
runs-on: ${{ matrix.runner }}
2627
steps:
27-
- uses: actions/checkout@v4
28+
- uses: actions/checkout@v5
29+
with:
30+
ref: ${{ inputs.checkout_ref }}
2831

2932
- name: Install OpenSSL (macOS)
3033
if: matrix.os == 'darwin'
3134
run: brew install openssl@3 || brew upgrade openssl@3 || true
3235

3336
- name: Build static redis-cli
37+
# Release builds must have a verified source checksum (fail closed).
38+
env:
39+
REDIS_CLI_REQUIRE_VERIFIED_SOURCE: 1
3440
run: ./build.sh --version "${{ inputs.release_tag }}" --os ${{ matrix.os }} --arch ${{ matrix.arch }} --output dist
3541

3642
- name: Smoke test
@@ -39,7 +45,7 @@ jobs:
3945
chmod +x "$bin"
4046
"$bin" --version
4147
42-
- uses: actions/upload-artifact@v4
48+
- uses: actions/upload-artifact@v6
4349
with:
4450
name: redis-cli-${{ matrix.os }}-${{ matrix.arch }}
4551
path: |

.github/workflows/cli.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: CLI
2+
3+
# Build and smoke-test every target on pull requests and pushes, using the Redis
4+
# version pinned in .redis_version.
5+
6+
on:
7+
pull_request:
8+
branches: [unstable, "release/*"]
9+
push:
10+
branches: [unstable, "release/*"]
11+
workflow_dispatch:
12+
workflow_call:
13+
14+
jobs:
15+
populate-env-vars:
16+
runs-on: ubuntu-latest
17+
outputs:
18+
BUILD_TARGETS: ${{ steps.parse.outputs.BUILD_TARGETS }}
19+
release_tag: ${{ steps.v.outputs.release_tag }}
20+
steps:
21+
- uses: actions/checkout@v5
22+
- name: Parse env file
23+
id: parse
24+
uses: ./.github/actions/parse-env-file
25+
- id: v
26+
run: echo "release_tag=$(cat .redis_version)" >> "$GITHUB_OUTPUT"
27+
28+
build-n-test:
29+
needs: populate-env-vars
30+
uses: ./.github/workflows/build-n-test.yml
31+
with:
32+
release_tag: ${{ needs.populate-env-vars.outputs.release_tag }}
33+
build_targets: ${{ needs.populate-env-vars.outputs.BUILD_TARGETS }}

.github/workflows/pull-request.yml

Lines changed: 0 additions & 23 deletions
This file was deleted.

0 commit comments

Comments
 (0)