-
Notifications
You must be signed in to change notification settings - Fork 4
/
release.sh
executable file
·58 lines (43 loc) · 1.87 KB
/
release.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# This script fetches the latest binary release
# version from the global SurrealDB downloads
# repository, along with the hash of the release
# file. It then uploads the latest release to
# the homebrew tap repository.
# ----------------------------------------
# Nightly
# ----------------------------------------
# Get the latest release version identifier
VERSION="nightly"
# Get the latest release version file hash
VERHASH=$(curl --silent --fail --location "https://download.surrealdb.com/${VERSION}/surreal-${VERSION}.darwin-universal.txt")
# Fetch the homebrew release template file
TEMPLATE=$(cat nightly.rb)
TEMPLATE=$(echo "$TEMPLATE" | sed "s/{VERSION}/$VERSION/g")
TEMPLATE=$(echo "$TEMPLATE" | sed "s/{VERHASH}/$VERHASH/g")
# Save the release template to the file
echo "$TEMPLATE" > Formula/surreal-nightly.rb
# ----------------------------------------
# Release
# ----------------------------------------
# Get the latest release version identifier
VERSION=$(curl --silent --fail --location "https://version.surrealdb.com")
# Get the latest release version file hash
VERHASH=$(curl --silent --fail --location "https://download.surrealdb.com/${VERSION}/surreal-${VERSION}.darwin-universal.txt")
# Get the latest release version without the preceding 'v'
RELEASE="${VERSION:1}"
# Fetch the homebrew release template file
TEMPLATE=$(cat release.rb)
TEMPLATE=$(echo "$TEMPLATE" | sed "s/{RELEASE}/$RELEASE/g")
TEMPLATE=$(echo "$TEMPLATE" | sed "s/{VERSION}/$VERSION/g")
TEMPLATE=$(echo "$TEMPLATE" | sed "s/{VERHASH}/$VERHASH/g")
# Save the release template to the file
echo "$TEMPLATE" > Formula/surreal.rb
# ----------------------------------------
# Commit
# ----------------------------------------
# Add all changed files to the git commit
git add --all
# Commit the new release to the repository
git commit -m "Upgrade to ${VERSION}"
# Deploy the latest release to Github
git push