mirror of
https://github.com/cucumber-sp/yandex-music-linux.git
synced 2024-12-23 22:22:59 +03:00
Build Tarballs
This commit is contained in:
parent
8bf13524b5
commit
96299ebb03
46
.github/workflows/build.sh
vendored
46
.github/workflows/build.sh
vendored
@ -1,46 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
set -e
|
|
||||||
|
|
||||||
if [ -f /etc/os-release ]; then
|
|
||||||
. /etc/os-release
|
|
||||||
OS=$NAME
|
|
||||||
elif [ -f /etc/lsb-release ]; then
|
|
||||||
. /etc/lsb-release
|
|
||||||
OS=$DISTRIB_ID
|
|
||||||
else
|
|
||||||
OS=$(uname -s)
|
|
||||||
fi
|
|
||||||
|
|
||||||
case $OS in
|
|
||||||
"Arch Linux")
|
|
||||||
echo "Arch Linux"
|
|
||||||
pacman -Syy --noconfirm
|
|
||||||
pacman -S --noconfirm git sudo base-devel p7zip nodejs jq asar electron27 libpulse dpkg unzip xdg-utils python
|
|
||||||
# fix makepkg from non-root
|
|
||||||
mkdir /home/build
|
|
||||||
chgrp nobody /home/build
|
|
||||||
chmod g+ws /home/build
|
|
||||||
setfacl -m u::rwx,g::rwx /home/build
|
|
||||||
setfacl -d --set u::rwx,g::rwx,o::- /home/build
|
|
||||||
chown nobody .
|
|
||||||
sudo -u nobody makepkg --log
|
|
||||||
|
|
||||||
mkdir dist
|
|
||||||
mv *.pkg.tar.zst dist
|
|
||||||
|
|
||||||
mv ./src/app/yandex-music.asar dist/yandex-music.asar
|
|
||||||
mv ./src/app/release_notes.json dist/release_notes.json
|
|
||||||
|
|
||||||
bash ./build_deb.sh -a all
|
|
||||||
mv deb/*.deb dist
|
|
||||||
;;
|
|
||||||
"Ubuntu")
|
|
||||||
echo NixOS
|
|
||||||
export NIXPKGS_ALLOW_UNFREE=1
|
|
||||||
nix build --impure
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
echo "Operating system is not recognized."
|
|
||||||
;;
|
|
||||||
esac
|
|
30
.github/workflows/build.yml
vendored
30
.github/workflows/build.yml
vendored
@ -21,20 +21,44 @@ jobs:
|
|||||||
container:
|
container:
|
||||||
image: archlinux:latest
|
image: archlinux:latest
|
||||||
steps:
|
steps:
|
||||||
|
- name: Install packages
|
||||||
|
run: pacman -Syy --noconfirm && pacman -S --noconfirm git sudo base-devel p7zip nodejs jq asar electron27 libpulse dpkg unzip xdg-utils python
|
||||||
|
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
ref: ${{ (inputs.ref || '') }}
|
ref: ${{ (inputs.ref || '') }}
|
||||||
|
|
||||||
- name: Build
|
- name: Create dist directory
|
||||||
run: bash ./.github/workflows/build.sh
|
run: mkdir -p dist
|
||||||
|
|
||||||
- name: Upload Arch artifact
|
- name: Fix permissions for build
|
||||||
|
run: mkdir /home/build && chgrp nobody /home/build && chmod g+ws /home/build && setfacl -m u::rwx,g::rwx /home/build && setfacl -d --set u::rwx,g::rwx,o::- /home/build && chown nobody .
|
||||||
|
|
||||||
|
- name: Make Arch package
|
||||||
|
run: sudo -u nobody makepkg --log && mv *.pkg.tar.zst dist/
|
||||||
|
|
||||||
|
- name: Build tarball packages
|
||||||
|
run: bash ./build_tarball.sh -a all && mv tar/* dist/
|
||||||
|
|
||||||
|
- name: Build Deb packages
|
||||||
|
run: bash ./build_deb.sh -a all && mv deb/*.deb dist
|
||||||
|
|
||||||
|
- name: Retrieve Asar and release notes
|
||||||
|
run: mv ./src/app/yandex-music.asar dist/yandex-music.asar && mv ./src/app/release_notes.json dist/release_notes.json
|
||||||
|
|
||||||
|
- name: Upload Arch artifacts
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
path: ./dist/*.pkg.tar.zst
|
path: ./dist/*.pkg.tar.zst
|
||||||
name: arch-packages
|
name: arch-packages
|
||||||
|
|
||||||
|
- name: Upload tarball artifacts
|
||||||
|
uses: actions/upload-artifact@v4
|
||||||
|
with:
|
||||||
|
path: ./dist/*.tar.gz
|
||||||
|
name: tar-packages
|
||||||
|
|
||||||
- name: Upload Deb artifact
|
- name: Upload Deb artifact
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
|
2
.gitignore
vendored
2
.gitignore
vendored
@ -7,3 +7,5 @@ app/
|
|||||||
arch/
|
arch/
|
||||||
|
|
||||||
deb/
|
deb/
|
||||||
|
|
||||||
|
tar/
|
||||||
|
53
build_deb.sh
53
build_deb.sh
@ -10,12 +10,14 @@ usage() {
|
|||||||
echo " -h Show this help and exit"
|
echo " -h Show this help and exit"
|
||||||
}
|
}
|
||||||
|
|
||||||
download_electron_binary(){
|
prepare_tarball(){
|
||||||
arch=${1}
|
arch=${1}
|
||||||
echo "Downloading electron ${arch}"
|
echo "Preparing tarball for ${arch}"
|
||||||
LINK=$(jq -r .electron."${arch}" ./utility/version_info.json)
|
if [ ! -f "tar/yandex-music_${version}_${arch}.tar.gz" ]; then
|
||||||
curl -L -o "${TEMPDIR}/electron-${arch}.zip" "${LINK}"
|
echo "Building tarball for ${arch}"
|
||||||
unzip -q "${TEMPDIR}/electron-${arch}.zip" -d "${TEMPDIR}/electron-${arch}"
|
bash build_tarball.sh -a "${arch}"
|
||||||
|
fi
|
||||||
|
cp "tar/yandex-music_${version}_${arch}.tar.gz" "${TEMPDIR}/yandex-music_${version}_${arch}.tar.gz"
|
||||||
}
|
}
|
||||||
|
|
||||||
build_deb(){
|
build_deb(){
|
||||||
@ -30,25 +32,8 @@ build_deb(){
|
|||||||
sed -i "s/%version%/${version}/g" "${pkgdir}/DEBIAN/control"
|
sed -i "s/%version%/${version}/g" "${pkgdir}/DEBIAN/control"
|
||||||
sed -i "s/%arch%/${pkgarch}/g" "${pkgdir}/DEBIAN/control"
|
sed -i "s/%arch%/${pkgarch}/g" "${pkgdir}/DEBIAN/control"
|
||||||
|
|
||||||
mkdir -p "${pkgdir}/usr/lib/yandex-music"
|
# extract tarball to pkgdir
|
||||||
mkdir -p "${pkgdir}/usr/share/applications"
|
tar -xzf "${TEMPDIR}/yandex-music_${version}_${arch}.tar.gz" -C "${pkgdir}"
|
||||||
mkdir -p "${pkgdir}/usr/share/licenses/yandex-music"
|
|
||||||
mkdir -p "${pkgdir}/usr/share/pixmaps"
|
|
||||||
mkdir -p "${pkgdir}/usr/bin"
|
|
||||||
|
|
||||||
install -Dm644 "${TEMPDIR}/app/yandex-music.asar" "${pkgdir}/usr/lib/yandex-music/yandex-music.asar"
|
|
||||||
|
|
||||||
install -Dm644 "${TEMPDIR}/app/favicon.png" "${pkgdir}/usr/share/pixmaps/yandex-music.png"
|
|
||||||
install -Dm644 "${TEMPDIR}/app/favicon.png" "${pkgdir}/usr/share/icons/hicolor/48x48/apps/yandex-music.png"
|
|
||||||
install -Dm644 "${TEMPDIR}/app/favicon.svg" "${pkgdir}/usr/share/icons/hicolor/scalable/apps/yandex-music.svg"
|
|
||||||
|
|
||||||
install -Dm644 "./templates/desktop" "${pkgdir}/usr/share/applications/yandex-music.desktop"
|
|
||||||
install -Dm644 "./LICENSE.md" "${pkgdir}/usr/share/licenses/yandex-music/LICENSE"
|
|
||||||
mv "${TEMPDIR}/electron-${arch}/" "${pkgdir}/usr/lib/yandex-music/electron"
|
|
||||||
|
|
||||||
echo "#!/bin/sh" > "${pkgdir}/usr/bin/yandex-music"
|
|
||||||
echo 'exec /usr/lib/yandex-music/electron/electron /usr/lib/yandex-music/yandex-music.asar "$@"' >> "${pkgdir}/usr/bin/yandex-music"
|
|
||||||
chmod 755 "${pkgdir}/usr/bin/yandex-music"
|
|
||||||
|
|
||||||
dpkg-deb --build "${pkgdir}" "deb/yandex-music_${version}_${pkgarch}.deb"
|
dpkg-deb --build "${pkgdir}" "deb/yandex-music_${version}_${pkgarch}.deb"
|
||||||
}
|
}
|
||||||
@ -101,34 +86,20 @@ trap clear EXIT
|
|||||||
|
|
||||||
#loading version info with jq
|
#loading version info with jq
|
||||||
version=$(jq -r '.ym.version' ./utility/version_info.json)
|
version=$(jq -r '.ym.version' ./utility/version_info.json)
|
||||||
exe_name=$(jq -r '.ym.exe_name' ./utility/version_info.json)
|
|
||||||
exe_link=$(jq -r '.ym.exe_link' ./utility/version_info.json)
|
|
||||||
exe_sha256=$(jq -r '.ym.exe_sha256' ./utility/version_info.json)
|
|
||||||
|
|
||||||
#downloading exe
|
|
||||||
echo "Downloading ${exe_name}"
|
|
||||||
curl -L -o "${TEMPDIR}/${exe_name}" "${exe_link}"
|
|
||||||
|
|
||||||
#checking sha256
|
|
||||||
echo "Checking sha256"
|
|
||||||
echo "${exe_sha256} ${TEMPDIR}/${exe_name}" | sha256sum -c
|
|
||||||
|
|
||||||
echo "Repaking ${exe_name}"
|
|
||||||
bash repack.sh -o "${TEMPDIR}/app" "${TEMPDIR}/${exe_name}"
|
|
||||||
|
|
||||||
mkdir -p "deb"
|
mkdir -p "deb"
|
||||||
|
|
||||||
if [ ${x64} -eq 1 ]; then
|
if [ ${x64} -eq 1 ]; then
|
||||||
download_electron_binary "x64"
|
prepare_tarball "x64"
|
||||||
build_deb "x64" "amd64"
|
build_deb "x64" "amd64"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ ${armv7l} -eq 1 ]; then
|
if [ ${armv7l} -eq 1 ]; then
|
||||||
download_electron_binary "armv7l"
|
prepare_tarball "armv7l"
|
||||||
build_deb "armv7l" "armhf"
|
build_deb "armv7l" "armhf"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ ${arm64} -eq 1 ]; then
|
if [ ${arm64} -eq 1 ]; then
|
||||||
download_electron_binary "arm64"
|
prepare_tarball "arm64"
|
||||||
build_deb "arm64" "arm64"
|
build_deb "arm64" "arm64"
|
||||||
fi
|
fi
|
131
build_tarball.sh
Normal file
131
build_tarball.sh
Normal file
@ -0,0 +1,131 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
usage() {
|
||||||
|
echo "Usage: $(basename "$0") [-h] [-a <x64|armv7l|arm64|all> default=x64]"
|
||||||
|
echo
|
||||||
|
echo " Options:"
|
||||||
|
echo " -a Architecture to build for (<x64|armv7l|arm64|all> default=x64)"
|
||||||
|
echo " -o Output directory"
|
||||||
|
echo " -h Show this help and exit"
|
||||||
|
}
|
||||||
|
|
||||||
|
download_electron_binary(){
|
||||||
|
arch=${1}
|
||||||
|
echo "Downloading electron ${arch}"
|
||||||
|
LINK=$(jq -r .electron."${arch}" ./utility/version_info.json)
|
||||||
|
curl -L -o "${TEMPDIR}/electron-${arch}.zip" "${LINK}"
|
||||||
|
unzip -q "${TEMPDIR}/electron-${arch}.zip" -d "${TEMPDIR}/electron-${arch}"
|
||||||
|
}
|
||||||
|
|
||||||
|
build_tarball(){
|
||||||
|
arch=${1}
|
||||||
|
app_dir="${TEMPDIR}/yandex-music_${version}_${arch}"
|
||||||
|
|
||||||
|
mkdir -p "${app_dir}/usr/lib/yandex-music"
|
||||||
|
mkdir -p "${app_dir}/usr/share/applications"
|
||||||
|
mkdir -p "${app_dir}/usr/share/licenses/yandex-music"
|
||||||
|
mkdir -p "${app_dir}/usr/share/pixmaps"
|
||||||
|
mkdir -p "${app_dir}/usr/bin"
|
||||||
|
|
||||||
|
install -Dm644 "${TEMPDIR}/app/yandex-music.asar" "${app_dir}/usr/lib/yandex-music/yandex-music.asar"
|
||||||
|
|
||||||
|
install -Dm644 "${TEMPDIR}/app/favicon.png" "${app_dir}/usr/share/pixmaps/yandex-music.png"
|
||||||
|
install -Dm644 "${TEMPDIR}/app/favicon.png" "${app_dir}/usr/share/icons/hicolor/48x48/apps/yandex-music.png"
|
||||||
|
install -Dm644 "${TEMPDIR}/app/favicon.svg" "${app_dir}/usr/share/icons/hicolor/scalable/apps/yandex-music.svg"
|
||||||
|
|
||||||
|
install -Dm644 "./templates/desktop" "${app_dir}/usr/share/applications/yandex-music.desktop"
|
||||||
|
install -Dm644 "./LICENSE.md" "${app_dir}/usr/share/licenses/yandex-music/LICENSE"
|
||||||
|
mv "${TEMPDIR}/electron-${arch}/" "${app_dir}/usr/lib/yandex-music/electron"
|
||||||
|
|
||||||
|
echo "#!/bin/sh" > "${app_dir}/usr/bin/yandex-music"
|
||||||
|
echo 'exec /usr/lib/yandex-music/electron/electron /usr/lib/yandex-music/yandex-music.asar "$@"' >> "${app_dir}/usr/bin/yandex-music"
|
||||||
|
chmod 755 "${app_dir}/usr/bin/yandex-music"
|
||||||
|
|
||||||
|
cd "${app_dir}"
|
||||||
|
tar cvfz "${OUTPUT_DIR}/yandex-music_${version}_${arch}.tar.gz" *
|
||||||
|
cd "${INITIAL_DIR}"
|
||||||
|
}
|
||||||
|
|
||||||
|
INITIAL_DIR="${PWD}"
|
||||||
|
OUTPUT_DIR="${PWD}/tar"
|
||||||
|
x64=0
|
||||||
|
armv7l=0
|
||||||
|
arm64=0
|
||||||
|
|
||||||
|
#checking for arch option (if not specified set x64) and h option
|
||||||
|
while getopts :a:h name; do
|
||||||
|
case ${name} in
|
||||||
|
a)
|
||||||
|
case ${OPTARG} in
|
||||||
|
x64) x64=1 ;;
|
||||||
|
armv7l) armv7l=1 ;;
|
||||||
|
arm64) arm64=1 ;;
|
||||||
|
all)
|
||||||
|
x64=1
|
||||||
|
armv7l=1
|
||||||
|
arm64=1
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "Invalid architecture specified"
|
||||||
|
usage
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
;;
|
||||||
|
h)
|
||||||
|
usage
|
||||||
|
exit 0
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
usage
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
#checking if at least one arch is specified else set x64
|
||||||
|
if [ ${x64} -eq 0 ] && [ ${armv7l} -eq 0 ] && [ ${arm64} -eq 0 ]; then
|
||||||
|
x64=1
|
||||||
|
fi
|
||||||
|
|
||||||
|
clear() {
|
||||||
|
rm -rf "${TEMPDIR}"
|
||||||
|
}
|
||||||
|
TEMPDIR="$(mktemp -d)"
|
||||||
|
trap clear EXIT
|
||||||
|
|
||||||
|
#loading version info with jq
|
||||||
|
version=$(jq -r '.ym.version' ./utility/version_info.json)
|
||||||
|
exe_name=$(jq -r '.ym.exe_name' ./utility/version_info.json)
|
||||||
|
exe_link=$(jq -r '.ym.exe_link' ./utility/version_info.json)
|
||||||
|
exe_sha256=$(jq -r '.ym.exe_sha256' ./utility/version_info.json)
|
||||||
|
|
||||||
|
#downloading exe
|
||||||
|
echo "Downloading ${exe_name}"
|
||||||
|
curl -L -o "${TEMPDIR}/${exe_name}" "${exe_link}"
|
||||||
|
|
||||||
|
#checking sha256
|
||||||
|
echo "Checking sha256"
|
||||||
|
echo "${exe_sha256} ${TEMPDIR}/${exe_name}" | sha256sum -c
|
||||||
|
|
||||||
|
echo "Repaking ${exe_name}"
|
||||||
|
bash repack.sh -o "${TEMPDIR}/app" "${TEMPDIR}/${exe_name}"
|
||||||
|
|
||||||
|
mkdir -p "${OUTPUT_DIR}"
|
||||||
|
|
||||||
|
if [ ${x64} -eq 1 ]; then
|
||||||
|
download_electron_binary "x64"
|
||||||
|
build_tarball "x64"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ${armv7l} -eq 1 ]; then
|
||||||
|
download_electron_binary "armv7l"
|
||||||
|
build_tarball "armv7l"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ${arm64} -eq 1 ]; then
|
||||||
|
download_electron_binary "arm64"
|
||||||
|
build_tarball "arm64"
|
||||||
|
fi
|
Loading…
Reference in New Issue
Block a user