Skip to content

Commit 7185548

Browse files
authored
Merge pull request #46 from redis/release_automation
Edit release_automation
2 parents 9eccdbe + a528c16 commit 7185548

File tree

5 files changed

+21
-153
lines changed

5 files changed

+21
-153
lines changed

.github/actions/bump-redis-version/action.yml

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

.github/actions/bump-redis-version/bump-redis-version.sh

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

.github/actions/common/edit-cask.sh

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,15 @@ TAG=""
1212
TAP="redis/redis"
1313
ACTION=""
1414

15+
# Detect OS for sed compatibility
16+
if [[ "$OSTYPE" == "darwin"* ]]; then
17+
# macOS requires empty string for in-place editing
18+
SED_INPLACE="sed -i ''"
19+
else
20+
# Linux doesn't need the empty string
21+
SED_INPLACE="sed -i"
22+
fi
23+
1524
# Function to display usage
1625
usage() {
1726
echo "Usage: $0 --cask <cask_name> --action <action> [--binary <binary_path>] [--package-json <json>] [--tap <tap_name>] <TAG>"
@@ -53,9 +62,9 @@ edit_cask_file(){
5362
fi
5463

5564
# Change url to file://
56-
sed -i '' "s|url \".*\"|url \"file://$binary_path\"|" $casks_path
65+
$SED_INPLACE "s|url \".*\"|url \"file://$binary_path\"|" $casks_path
5766
# Remove sha256 verification since it's testing
58-
sed -i '' '/sha256 arm:/,/intel:.*"$/d' $casks_path
67+
$SED_INPLACE '/sha256 arm:/,/intel:.*"$/d' $casks_path
5968

6069
elif [ "$action" = "publish" ]; then
6170
casks_path="$(pwd)/Casks/${cask_name}.rb"
@@ -75,8 +84,8 @@ edit_cask_file(){
7584
# Update sha256 values in cask file
7685
if [ -n "$arm_sha" ] && [ -n "$intel_sha" ]; then
7786
# Replace existing sha256 line with new values
78-
sed -i "s/sha256 arm: \"[^\"]*\",$/sha256 arm: \"$arm_sha\",/" $casks_path
79-
sed -i "/sha256 arm:/,/intel:/ s/intel: \"[^\"]*\"/intel: \"$intel_sha\"/" "$casks_path"
87+
$SED_INPLACE "s/sha256 arm: \"[^\"]*\",$/sha256 arm: \"$arm_sha\",/" $casks_path
88+
$SED_INPLACE "/sha256 arm:/,/intel:/ s/intel: \"[^\"]*\"/intel: \"$intel_sha\"/" "$casks_path"
8089
else
8190
echo "Error: Missing sha256 values in package_json"
8291
exit 1
@@ -88,7 +97,7 @@ edit_cask_file(){
8897
fi
8998

9099
# Change version
91-
sed -i "s/version \"[^\"]*\"/version \"$tag\"/" $casks_path
100+
$SED_INPLACE "s/version \"[^\"]*\"/version \"$tag\"/" $casks_path
92101
}
93102

94103
# Parse command line arguments

.github/actions/upload-packages/action.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,12 @@ runs:
7979
for dir in redis-oss-*; do
8080
arch=$(echo $dir | sed -E 's/.*-([^-]+)\.zip$/\1/')
8181
sha256=$(shasum -a 256 $dir/*.zip | awk '{print $1}')
82+
83+
# Only copy if binary doesn't exist
84+
aws s3api head-object --bucket ${{ inputs.BREW_S3_BUCKET }} --key homebrew/$dir >/dev/null 2>&1 || \
8285
aws s3 cp $dir/*.zip s3://${{ inputs.BREW_S3_BUCKET }}/homebrew/ --acl public-read
8386
84-
# build json structure incrementally with arch and sha256
87+
# Build json structure incrementally with arch and sha256
8588
packages_sha256_json=$(echo "$packages_sha256_json" | jq --arg arch "$arch" --arg sha256 "$sha256" \
8689
'.[$arch] = {"sha256": $sha256}')
8790
done

.github/workflows/release_build_and_test.yml

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -41,14 +41,6 @@ jobs:
4141
allow_modify: true
4242
gh_token: ${{ secrets.GITHUB_TOKEN }}
4343

44-
- name: Bump redis version
45-
id: bump-version
46-
uses: ./.github/actions/bump-redis-version
47-
with:
48-
release_tag: ${{ github.event.inputs.release_tag }}
49-
release_version_branch: ${{ steps.ensure-branch.outputs.release_version_branch }}
50-
release_type: ${{ github.event.inputs.release_type }}
51-
5244
build-n-test:
5345
needs: prepare-release
5446
uses: ./.github/workflows/build-n-test.yml
@@ -87,6 +79,9 @@ jobs:
8779
runs-on: ubuntu-latest
8880
if: failure()
8981
steps:
82+
- name: Checkout code
83+
uses: actions/checkout@v4
84+
9085
- name: Detect env name
9186
id: detect-env
9287
run: |

0 commit comments

Comments
 (0)