-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrelease_script.sh
More file actions
executable file
·50 lines (42 loc) · 1.9 KB
/
release_script.sh
File metadata and controls
executable file
·50 lines (42 loc) · 1.9 KB
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
#!/bin/bash
set -e
echo "-----------------------------------------------------"
echo "DO NOT RUN UNLESS YOU KNOW THE CODE COMPILES CLEANLY"
echo "THIS CAN TAKE 15 MINUTES TO COMPLETE"
echo "-----------------------------------------------------"
VERSION=$(grep -m 1 '^version = ' Cargo.toml | sed 's/version = "\(.*\)"/\1/')
TAG="v$VERSION"
SHA=$(git rev-parse "$TAG")
echo "Waiting for Github Actions to register runs for commit $SHA ($TAG)..."
while true; do
TOTAL_RUNS=$(gh run list --commit "$SHA" --json status -q 'length')
if [ "$TOTAL_RUNS" -gt 0 ]; then
break
fi
echo "Waiting for runs to start..."
sleep 5
done
echo "Waiting for Github Actions to complete for commit $SHA..."
while true; do
ACTIVE_RUNS=$(gh run list --commit "$SHA" --json status -q 'map(select(.status != "completed")) | length')
if [ "$ACTIVE_RUNS" -eq 0 ]; then
break
fi
echo "Still running: $ACTIVE_RUNS workflows active..."
sleep 10
done
TOTAL_RUNS=$(gh run list --commit "$SHA" --json conclusion -q 'length')
SUCCESS_RUNS=$(gh run list --commit "$SHA" --json conclusion -q 'map(select(.conclusion == "success")) | length')
if [ "$SUCCESS_RUNS" -eq "$TOTAL_RUNS" ] && [ "$TOTAL_RUNS" -gt 0 ]; then
echo "CI pipeline completed successfully."
echo "Cleaning old artifact directories..."
rm -rf ./linux_rpm ./linux_deb ./windows_release ./macos_release
echo "Downloading artifacts..."
gh run download -n RustTracker-Linux-RPM --dir ./linux_rpm || true
gh run download -n RustTracker-Linux-DEB --dir ./linux_deb || true
gh run download -n RustTracker-Windows --dir ./windows_release || true
gh run download -n RustTracker-MacOS --dir ./macos_release || true
echo "Creating GitHub Release..."
gh release create "$TAG" ./windows_release/*.exe ./linux_rpm/*.rpm ./linux_deb/*.deb ./macos_release/*.dmg ./RustTracker-SteamDeck-$TAG.AppImage --title "RustTracker $TAG" --notes "Release $TAG"
fi
echo "Done!"