Skip to content

Commit d3859ff

Browse files
Add prepare-artifacts script to download, extract, and rename CI jobs and other files to be published after a release
1 parent 6091a16 commit d3859ff

File tree

2 files changed

+161
-0
lines changed

2 files changed

+161
-0
lines changed

scripts/openrgb-udev-install.sh

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#! /bin/bash
2+
3+
STEAMOS=0
4+
STEAMOS_READONLY=0
5+
6+
# Test for SteamOS and disable readonly mode if we're running on it
7+
if command -v steamos-readonly >& /dev/null
8+
then
9+
# Test if SteamOS readonly mode is enabled
10+
if sudo steamos-readonly status | grep 'enabled'
11+
then
12+
echo "steamos readonly mode is true"
13+
STEAMOS_READONLY=1
14+
fi
15+
16+
STEAMOS=1
17+
sudo steamos-readonly disable
18+
fi
19+
20+
# Download udev rules file
21+
wget https://openrgb.org/releases/release_0.9/60-openrgb.rules
22+
23+
# Move udev rules file to udev rules directory
24+
sudo mv 60-openrgb.rules /usr/lib/udev/rules.d
25+
26+
# Reload the rules
27+
sudo udevadm control --reload-rules
28+
sudo udevadm trigger
29+
30+
if [ "$STEAMOS" = 1 ] ; then
31+
if [ "$STEAMOS_READONLY" = 1 ] ; then
32+
sudo steamos-readonly enable
33+
fi
34+
fi

scripts/prepare-artifacts.py

Lines changed: 127 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,127 @@
1+
#############################################
2+
# OpenRGB Artifacts Extract/Prepare Script #
3+
# #
4+
# Downloads artifacts from GitLab CI, #
5+
# extracts the zip archives, and renames #
6+
# them to the format used for release #
7+
# downloads on the website. #
8+
#############################################
9+
10+
import os
11+
12+
#############################################
13+
# OpenRGB version #
14+
#############################################
15+
version = "0.9+"
16+
17+
#############################################
18+
# Git version (tag, branch, or commit) #
19+
#############################################
20+
git_id = "master"
21+
22+
command = "git rev-list -n 1 " + git_id
23+
print(command)
24+
commit = os.popen(command).read().strip()
25+
26+
command = "git rev-parse --short=7 " + commit
27+
print(command)
28+
commit = os.popen(command).read().strip()
29+
30+
git_url = "https://gitlab.com/CalcProgrammer1/OpenRGB/-/jobs/artifacts/" + git_id + "/download?job="
31+
32+
#############################################
33+
# List of artifacts to download #
34+
#############################################
35+
artifacts = [
36+
[ "Windows%2064%20MSI", "OpenRGB_" + version + "_Windows_64_" + commit, ".msi" ],
37+
[ "Windows%2064", "OpenRGB_" + version + "_Windows_64_" + commit, ".zip" ],
38+
[ "Windows%2032", "OpenRGB_" + version + "_Windows_32_" + commit, ".zip" ],
39+
[ "Linux+amd64+.deb+%28Debian+Bookworm%29", "openrgb_" + version + "_amd64_bookworm_" + commit, ".deb" ],
40+
[ "Linux+i386+.deb+%28Debian+Bookworm%29", "openrgb_" + version + "_i386_bookworm_" + commit, ".deb" ],
41+
[ "Linux%20amd64%20AppImage", "OpenRGB_" + version + "_x86_64_" + commit, ".AppImage" ],
42+
[ "Linux%20i386%20AppImage", "OpenRGB_" + version + "_i386_" + commit, ".AppImage" ],
43+
[ "Linux+64+F40+rpm", "openrgb_" + version + "_x86_64_f40_" + commit, ".rpm" ],
44+
[ "Linux+arm64+.deb+%28Debian%20Bookworm%29", "openrgb_" + version + "_arm64_bookworm_" + commit, ".deb" ],
45+
[ "Linux+armhf+.deb+%28Debian%20Bookworm%29", "openrgb_" + version + "_armhf_bookworm_" + commit, ".deb" ],
46+
[ "Linux%20arm64%20AppImage", "OpenRGB_" + version + "_arm64_" + commit, ".AppImage" ],
47+
[ "Linux%20armhf%20AppImage", "OpenRGB_" + version + "_armhf_" + commit, ".AppImage" ],
48+
[ "MacOS%20Intel", "OpenRGB_" + version + "_MacOS_Intel_" + commit, ".zip" ],
49+
[ "MacOS%20ARM64", "OpenRGB_" + version + "_MacOS_ARM64_" + commit, ".zip" ]
50+
]
51+
52+
command = "mkdir artifacts"
53+
print(command)
54+
os.system(command)
55+
56+
command = "mkdir download"
57+
print(command)
58+
os.system(command)
59+
60+
#############################################
61+
# Loop through all artifacts #
62+
#############################################
63+
for artifact in artifacts:
64+
#########################################
65+
# Download the artifact #
66+
#########################################
67+
command = "wget " + git_url + artifact[0] + " -O download.zip"
68+
print(command)
69+
os.system(command)
70+
71+
if(artifact[2] != ".zip"):
72+
#########################################
73+
# Unzip the downloaded artifact #
74+
#########################################
75+
command = "unzip download.zip -d download"
76+
print(command)
77+
os.system(command)
78+
79+
#########################################
80+
# Delete downloaded zip #
81+
#########################################
82+
command = "rm download.zip"
83+
print(command)
84+
os.system(command)
85+
86+
#########################################
87+
# Rename downloaded artifact file and #
88+
# move it to artifacts folder #
89+
#########################################
90+
command = "mv download/*" + artifact[2] + " artifacts/" + artifact[1] + artifact[2]
91+
print(command)
92+
os.system(command)
93+
94+
#########################################
95+
# If AppImage, also copy udev rules #
96+
#########################################
97+
if(artifact[2] == ".AppImage"):
98+
command = "mv download/60-openrgb.rules artifacts/60-openrgb.rules"
99+
print(command)
100+
os.system(command)
101+
102+
#########################################
103+
# Delete any remaining download files #
104+
#########################################
105+
command = "rm -r download/*"
106+
print(command)
107+
os.system(command)
108+
109+
else:
110+
#########################################
111+
# Rename downloaded zip and move it to #
112+
# artifacts folder #
113+
#########################################
114+
command = "mv download.zip artifacts/" + artifact[1] + artifact[2]
115+
print(command)
116+
os.system(command)
117+
118+
#############################################
119+
# The openrgb-udev-install.sh script is #
120+
# not a CI artifact. Download it #
121+
# separately. #
122+
#############################################
123+
udev_url = "https://gitlab.com/CalcProgrammer1/OpenRGB/-/raw/master/scripts/openrgb-udev-install.sh"
124+
125+
command = "wget " + udev_url + " -O artifacts/openrgb-udev-install.sh"
126+
print(command)
127+
os.system(command)

0 commit comments

Comments
 (0)