Add scripts that add Java dependency to deb and rpm files, and fix names on build

Co-authored-by: Mahor <73415437+mahor1221@users.noreply.github.com>
This commit is contained in:
Syer10
2022-01-18 18:33:04 -05:00
parent 7cfc6a6853
commit e5e2491f05
5 changed files with 80 additions and 0 deletions

View File

@@ -112,6 +112,17 @@ jobs:
- name: Download Build Artifacts
uses: actions/download-artifact@v2
- name: Fix rpm java dependency
uses: Syer10/CentOS-Java16-Action@v1
with:
command: ./scripts/RpmDependnencyFix.sh
- name: Fix deb java dependency
run: ./scripts/DebDependencyFix.sh
- name: Fix filenames
run: ./scripts/NamingFix.sh
- uses: ncipollo/release-action@v1
with:
artifacts: "*/binaries/main/*/*.*,*/jars/*.jar"

View File

@@ -119,6 +119,17 @@ jobs:
- name: Download Build Artifacts
uses: actions/download-artifact@v2
- name: Fix rpm java dependency
uses: Syer10/CentOS-Java16-Action@v1
with:
command: ./scripts/RpmDependnencyFix.sh
- name: Fix deb java dependency
run: ./scripts/DebDependencyFix.sh
- name: Fix filenames
run: ./scripts/NamingFix.sh
- name: Get previous release
id: last_release
uses: Dmagine/get-latest-release@master

View File

@@ -0,0 +1,25 @@
#!/bin/bash
deb="$(find ./build/compose/binaries/main/deb/*.deb)"
dir="$(dirname "$deb")"
echo "Found deb file $deb in $dir"
mkdir "$dir/tmp" || exit 1
echo "Extracting deb file"
ar x "$deb" --output "$dir/tmp"
mkdir "$dir/tmp/control_dir"
echo "Extracting control tar"
tar -xf "$dir/tmp/control.tar.xz" -C "$dir/tmp/control_dir"
# remove whitespace
echo "Adding java dependency"
sed -i "/^Depends:/s/ $//" "$dir/tmp/control_dir/control"
# grep: if rerun on the same file don't change it again
grep -qxF "java8-runtime-headless" "$dir/tmp/control_dir/control" ||\
sed -i "/^Depends:/s/$/, java8-runtime-headless/" "$dir/tmp/control_dir/control"
echo "Compressing new control tar"
tar -cf "$dir/tmp/control.tar.xz" -C "$dir/tmp/control_dir" -I "xz" .
rm -rf "$dir/tmp/control_dir"
echo "Making new deb file"
ar rcs "$deb" "$dir/tmp/"*
echo "Cleaning up"
rm -rf "$dir/tmp"

21
scripts/NamingFix.sh Normal file
View File

@@ -0,0 +1,21 @@
#!/bin/bash
msi="$(find ./build/compose/binaries/main/msi/*.msi 2>/dev/null)"
if [ -f "$msi" ]; then
dir="$(dirname "$msi")"
version=$(tmp="${msi%.*}" && echo "${tmp##*-}")
if [ "$(basename "$msi")" != "Tachidesk-JUI-windows-x64-$version.msi" ]; then
mv "$msi" "$dir/Tachidesk-JUI-windows-x64-$version.msi"
fi
fi
dmg="$(find ./build/compose/binaries/main/dmg/*.dmg 2>/dev/null)"
if [ -f "$dmg" ]; then
dir="$(dirname "$dmg")"
version=$(tmp="${dmg%.*}" && echo "${tmp##*-}")
if [ "$(basename "$dmg")" != "Tachidesk-JUI-macos-x64-$version.dmg" ]; then
mv "$dmg" "$dir/Tachidesk-JUI-macos-x64-$version.dmg"
fi
fi

View File

@@ -0,0 +1,12 @@
#!/bin/bash
rpm="$(find ./build/compose/binaries/main/rpm/*.rpm)"
dir="$(dirname "$rpm")"
echo "Adding java dependency to rpm file $rpm in $dir"
rpmrebuild -d "$dir" -np --change-spec-requires="echo Requires: java-1.8.0-openjdk-headless" "$rpm"
echo "Cleaning up"
rm -f "$rpm"
mv "$dir"/*/*'.rpm' "$dir"