Some checks failed
Build hyprland-git / Build and push image (push) Failing after 4m50s
53 lines
2.6 KiB
Bash
Executable File
53 lines
2.6 KiB
Bash
Executable File
#!/usr/bin/bash
|
|
set -euxo pipefail
|
|
|
|
curl_opts=(--connect-timeout 10 --retry 7 --retry-connrefused -Ss -X POST)
|
|
|
|
oldHyprlandVersion="$(sed -n 's/Version: \(.*\)/\1/p' hyprland-git.spec | grep -Eow "[\.0-9]+")"
|
|
newHyprlandVersion="$(curl -L \
|
|
-H "Accept: application/vnd.github+json" \
|
|
-H "X-GitHub-Api-Version: 2022-11-28" \
|
|
"https://api.github.com/repos/hyprwm/Hyprland/releases" | jq -r 'first.name' | sed -e "s/^v//")"
|
|
|
|
oldBumpVersion="$(sed -n 's/.*bumpver \(.*\)/\1/p' hyprland-git.spec)"
|
|
newBumpVersion=oldBumpVersion
|
|
|
|
if [[ "$oldHyprlandVersion" == "$newHyprlandVersion" ]]; then
|
|
newBumpVersion=$((newBumpVersion+1))
|
|
else
|
|
newBumpVersion=1
|
|
fi
|
|
|
|
oldHyprlandCommit="$(sed -n 's/.*hyprland_commit \(.*\)/\1/p' hyprland-git.spec)"
|
|
newHyprlandCommit="$(curl -s -H "Accept: application/vnd.github.VERSION.sha" "https://api.github.com/repos/hyprwm/Hyprland/commits/main")"
|
|
|
|
oldCommitsCount="$(sed -n 's/.*commits_count \(.*\)/\1/p' hyprland-git.spec)"
|
|
newCommitsCount="$(curl -I -k \
|
|
"https://api.github.com/repos/hyprwm/Hyprland/commits?per_page=1&sha=$newHyprlandCommit" | \
|
|
sed -n '/^[Ll]ink:/ s/.*"next".*page=\([0-9]*\).*"last".*/\1/p')"
|
|
|
|
oldCommitDate="$(sed -n 's/.*commit_date \(.*\)/\1/p' hyprland-git.spec)"
|
|
newCommitDate="$(env TZ=Etc/GMT+12 date -d "$(curl -s "https://api.github.com/repos/hyprwm/Hyprland/commits?per_page=1&ref=$newHyprlandCommit" | \
|
|
jq -r '.[].commit.author.date')" +"%a %b %d %T %Y")"
|
|
|
|
oldProtocolsCommit="$(sed -n 's/.*protocols_commit \(.*\)/\1/p' hyprland-git.spec)"
|
|
newProtocolsCommit="$(curl -L \
|
|
-H "Accept: application/vnd.github+json" \
|
|
-H "X-GitHub-Api-Version: 2022-11-28" \
|
|
"https://api.github.com/repos/hyprwm/Hyprland/contents/subprojects/hyprland-protocols?ref=$newHyprlandCommit" | jq -r '.sha')"
|
|
|
|
oldUdis86Commit="$(sed -n 's/.*udis86_commit \(.*\)/\1/p' hyprland-git.spec)"
|
|
newUdis86Commit="$(curl -L \
|
|
-H "Accept: application/vnd.github+json" \
|
|
-H "X-GitHub-Api-Version: 2022-11-28" \
|
|
"https://api.github.com/repos/hyprwm/Hyprland/contents/subprojects/udis86?ref=$newHyprlandCommit" | jq -r '.sha')"
|
|
|
|
sed -e "s/$oldHyprlandCommit/$newHyprlandCommit/" \
|
|
-e "/%global bumpver/s/$oldBumpVersion/$newBumpVersion/" \
|
|
-e "/%global commits_count/s/$oldCommitsCount/$newCommitsCount/" \
|
|
-e "s/$oldCommitDate/$newCommitDate/" \
|
|
-e "s/$oldProtocolsCommit/$newProtocolsCommit/" \
|
|
-e "s/$oldUdis86Commit/$newUdis86Commit/" \
|
|
-e "/Version: /s/$oldHyprlandVersion/$newHyprlandVersion/" \
|
|
-i hyprland-git.spec
|