Move deb building out of the build pipeline

This commit is contained in:
Aaron Reisman 2023-01-22 13:01:12 -06:00
parent 7d3a39c693
commit 6cfd2dea96
6 changed files with 12 additions and 31 deletions

View file

@ -15,10 +15,6 @@ on:
description: 'Skip running unit tests'
required: false
default: true
outputs:
version:
description: "The Libation version number"
value: ${{ jobs.build.outputs.version }}
env:
DOTNET_CONFIGURATION: 'Release'

View file

@ -15,10 +15,6 @@ on:
description: 'Skip running unit tests'
required: false
default: true
outputs:
version:
description: "The Libation version number"
value: ${{ jobs.build.outputs.version }}
env:
DOTNET_CONFIGURATION: 'Release'
@ -27,8 +23,6 @@ env:
jobs:
build:
runs-on: windows-latest
outputs:
version: ${{ steps.get_version.outputs.version }}
strategy:
matrix:
os: [Windows]
@ -74,7 +68,7 @@ jobs:
- name: Zip artifact
id: zip
working-directory: ./Source/bin/Publish
run: |
run: |
$dir = "${{ matrix.os }}-${{ matrix.release_name }}\"
$delfiles = @("libmp3lame.so", "ffmpegaac.so", "glass-with-glow_256.svg", "Libation.desktop")
foreach ($file in $delfiles){ if (test-path $dir$file){ Remove-Item $dir$file } }

View file

@ -15,11 +15,6 @@ on:
description: 'Skip running unit tests'
required: false
default: true
build_deb:
type: boolean
description: 'Build Debian package'
required: false
default: false
jobs:
windows:
@ -32,12 +27,4 @@ jobs:
uses: ./.github/workflows/build-linux.yml
with:
version_override: ${{ inputs.version_override }}
run_unit_tests: ${{ inputs.run_unit_tests }}
linux_deb:
needs: [linux]
if: inputs.build_deb
uses: ./.github/workflows/build-deb.yml
with:
version: ${{ needs.linux.outputs.version }}
run_unit_tests: ${{ inputs.run_unit_tests }}

View file

@ -1,7 +1,7 @@
# build-deb.yml
# deb.yml
# Reusable workflow that builds the Linux Debian package.
---
name: build_deb
name: deb
on:
workflow_call:
@ -21,15 +21,14 @@ jobs:
- uses: actions/checkout@v3
- name: Download Artifact
uses: actions/download-artifact@master
uses: actions/download-artifact@v3
with:
name: "${{ env.FILE_NAME }}.tar.gz"
- name: Build .deb
id: deb
run: |
chmod +x ./.github/workflows/scripts/targz2deb.sh
./.github/workflows/scripts/targz2deb.sh "${{ env.FILE_NAME }}.tar.gz" ${{ inputs.version }}
./Scripts/targz2deb.sh "${{ env.FILE_NAME }}.tar.gz" ${{ inputs.version }}
- name: Publish .deb
uses: actions/upload-artifact@v3

View file

@ -33,7 +33,12 @@ jobs:
with:
version_override: ${{ needs.prerelease.outputs.version }}
run_unit_tests: false
build_deb: true
deb:
needs: [prerelease,build]
uses: ./.github/workflows/build-deb.yml
with:
version: ${{ needs.prerelease.outputs.version }}
release:
needs: [prerelease,build]

View file

@ -1,136 +0,0 @@
#!/bin/bash
FILE=$1; shift
VERSION=$1; shift
if [ -z "$FILE" ]
then
echo "This script must be called with a the Libation Linux bin zip file as an argument."
exit
fi
if [ ! -f "$FILE" ]
then
echo "The file \"$FILE\" does not exist."
exit
fi
if [ -z "$VERSION" ]
then
echo "This script must be called with the Libation version number as an argument."
exit
fi
contains() { case "$1" in *"$2"*) true ;; *) false ;; esac }
if ! contains "$FILE" "$VERSION"
then
echo "This script must be called with a Libation version number that is present in the filename passed."
exit
fi
# remove trailing ".tar.gz"
FOLDER_MAIN=${FILE::-7}
echo "Working dir: $FOLDER_MAIN"
if [[ -d "$FOLDER_MAIN" ]]
then
echo "$FOLDER_MAIN directory already exists, aborting."
exit
fi
FOLDER_EXEC="$FOLDER_MAIN/usr/lib/libation"
echo "Exec dir: $FOLDER_EXEC"
FOLDER_ICON="$FOLDER_MAIN/usr/share/icons/hicolor/scalable/apps/"
echo "Icon dir: $FOLDER_ICON"
FOLDER_DESKTOP="$FOLDER_MAIN/usr/share/applications"
echo "Desktop dir: $FOLDER_DESKTOP"
FOLDER_DEBIAN="$FOLDER_MAIN/DEBIAN"
echo "Debian dir: $FOLDER_DEBIAN"
mkdir -p "$FOLDER_EXEC"
mkdir -p "$FOLDER_ICON"
mkdir -p "$FOLDER_DESKTOP"
mkdir -p "$FOLDER_DEBIAN"
echo "Extracting $FILE to $FOLDER_EXEC..."
tar -xzf ${FILE} -C ${FOLDER_EXEC}
if [ $? -ne 0 ]
then echo "Error extracting ${FILE}"
exit
fi
echo "Copying icon..."
cp "$FOLDER_EXEC/glass-with-glow_256.svg" "$FOLDER_ICON/libation.svg"
echo "Copying desktop file..."
cp "$FOLDER_EXEC/Libation.desktop" "$FOLDER_DESKTOP/Libation.desktop"
echo "Workaround for desktop file..."
sed -i '/^Exec=Libation/c\Exec=/usr/bin/libation' "$FOLDER_DESKTOP/Libation.desktop"
echo "Creating pre-install file..."
echo "#!/bin/bash
# Pre-install script, removes previous installation program files and sym links
echo \"Removing previously created symlinks...\"
rm /usr/bin/libation
rm /usr/bin/Libation
rm /usr/bin/hangover
rm /usr/bin/Hangover
rm /usr/bin/libationcli
rm /usr/bin/LibationCli
echo \"Removing previously installed Libation files...\"
rm -r /usr/lib/libation
rm -r /usr/lib/Libation
# making sure it won't stop installation
exit 0
" >> "$FOLDER_DEBIAN/preinst"
echo "Creating post-install file..."
echo "#!/bin/bash
gtk-update-icon-cache -f /usr/share/icons/hicolor/
ln -s /usr/lib/libation/Libation /usr/bin/libation
ln -s /usr/lib/libation/Hangover /usr/bin/hangover
ln -s /usr/lib/libation/LibationCli /usr/bin/libationcli
# Increase the maximum number of inotify instances
echo fs.inotify.max_user_instances=524288 | tee -a /etc/sysctl.conf && sysctl -p
# workaround until this file is moved to the user's home directory
touch /usr/lib/libation/appsettings.json
chmod 666 /usr/lib/libation/appsettings.json
" >> "$FOLDER_DEBIAN/postinst"
echo "Creating control file..."
echo "Package: Libation
Version: $VERSION
Architecture: all
Essential: no
Priority: optional
Maintainer: github.com/rmcrackan
Description: liberate your audiobooks
" >> "$FOLDER_DEBIAN/control"
echo "Changing permissions for pre- and post-install files..."
chmod +x "$FOLDER_DEBIAN/preinst"
chmod +x "$FOLDER_DEBIAN/postinst"
echo "Creating .deb file..."
dpkg-deb --build $FOLDER_MAIN
rm -r "$FOLDER_MAIN"
echo "Done!"