Skip to content

Commit

Permalink
CI/CD - add .deb package building workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
gkv311 committed Dec 25, 2024
1 parent 60b2b3b commit 0ead28c
Show file tree
Hide file tree
Showing 3 changed files with 101 additions and 82 deletions.
14 changes: 13 additions & 1 deletion .github/workflows/build_ubuntu_24.04.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,16 @@ jobs:
libavcodec-dev libavdevice-dev libavformat-dev libavutil-dev libswscale-dev
- name: Compile
run: |
./continuousIntegration/build_sview_linux.sh
bash ./continuousIntegration/build_sview_linux.sh
- name: Extra Dependencies
run: |
sudo apt-get install -y \
build-essential devscripts
- name: Debian package
run: |
bash ./distribution/buildDebSrc.sh
#- name: Upload artifacts
# uses: actions/upload-artifact@v4
# with:
# name: sview-debpackage
# path: distribution/temp
91 changes: 88 additions & 3 deletions distribution/buildDebSrc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,54 @@
# go to the script directory
aScriptPath=${BASH_SOURCE%/*}
if [ -d "$aScriptPath" ]; then
cd "$aScriptPath"
cd "$aScriptPath"
fi

#sudo apt-get install build-essential devscripts

# build source package and sign it
#debuildParams="-S"
# build unsigned source package
#debuildParams="-S -us -uc"
# build unsigned source and binary packages
debuildParams="-us -uc"

aCurrentRelease=`lsb_release -c -s`
aDistribs=("$aCurrentRelease")

# Ubuntu 14.04 LTS (Trusty Tahr)
# Ubuntu 15.04 (Vivid Vervet)
# Ubuntu 15.10 (Wily Werewolf)
# Ubuntu 16.04 LTS (Xenial Xerus)
# Ubuntu 16.10 (Yakkety Yak)
# Ubuntu 17.04 (Zesty Zapus)
# Ubuntu 17.10 (Artful Aardvark)
# Ubuntu 18.04 LTS (Bionic Beaver)
# Ubuntu 18.10 (Cosmic Cuttlefish)
# Ubuntu 19.04 (Disco Dingo)
# Ubuntu 19.10
# Ubuntu 20.04 LTS (Focal Fossa)
# Ubuntu 20.10 (Groovy Gorilla)
# Ubuntu 21.04 (Hirsute Hippo)
# Ubuntu 21.10 (Impish Indri)
# Ubuntu 22.04 LTS (Jammy Jellyfish)
# Ubuntu 24.04 LTS (Noble Numbat)
#aDistribs=("focal" "jammy" "noble")

# Debian
#aDistribs=("stable" "unstable" "testing-proposed-updates" "experimental")

YEAR=$(date +"%y")
MONTH=$(date +"%m")
DAY=$(date +"%d")
aCurrentDate=`date --rfc-2822`
aVersion=${YEAR}.${MONTH}
aRelease=1
aDebVersion=${aVersion}-${aRelease}
aDebSrcRoot=temp/sview-${aDebVersion}

set -o pipefail

# copy common files
rm --force --recursive $aDebSrcRoot
mkdir -p $aDebSrcRoot
Expand Down Expand Up @@ -65,9 +102,57 @@ sed "s/unknown_release/${aRelease}/g" "$aDebSrcRoot/sView.rpm.spectmp1" > "$aDe
#sed "s/unknown_date/${aCurrentDate}/g" "$aDebSrcRoot/sView.rpm.spectmp2" > "$aDebSrcRoot/sView.rpm.spec"
rm -f $aDebSrcRoot/sView.rpm.spectmp*

pushd .
cd temp
# backup unmodified sources into archive
pushd temp
tar -czvf sview-${aVersion}-${aRelease}.tar.gz sview-${aVersion}-${aRelease}
mkdir -p src
mv -f sview-${aVersion}-${aRelease}.tar.gz ./src
popd

# remove temporary files
rm -f temp/*.build
rm -f temp/*.buildinfo
rm -f temp/*.changes
rm -f temp/*.dsc
rm -f temp/*.tar.gz
rm -f temp/*.tar.xz

# build Debian package(s)
pushd ${aDebSrcRoot}
for aDistr in "${aDistribs[@]}"
do
echo "Prepare source package for '$aDistr'"
sed "s/unknown_distrib/${aDistr}/g" "debian/changelog.tmpl" > "debian/changelogtmp1"
sed "s/unknown_version/1:${aDebVersion}~${aDistr}/g" "debian/changelogtmp1" > "debian/changelogtmp2"
sed "s/unknown_date/${aCurrentDate}/g" "debian/changelogtmp2" > "debian/changelog"
rm -f debian/changelogtmp*

mkdir -p ../$aDistr
aLogFile="../$aDistr/build.log"
rm -f $aLogFile
debuild ${debuildParams[@]} 2>&1 | tee -a "$aLogFile"
aResult=$?; if [[ $aResult != 0 ]]; then exit $aResult; fi

aWarns=`grep "^E: " $aLogFile`
while IFS= read -r aWarnIter ; do echo "::warning title=debuild::$aWarnIter"; done <<< "$aWarns"

aWarns=`grep "^W: " $aLogFile`
while IFS= read -r aWarnIter ; do echo "::warning title=debuild::$aWarnIter"; done <<< "$aWarns"

mv -f ../*.build ../$aDistr
mv -f ../*.buildinfo ../$aDistr
mv -f ../*.changes ../$aDistr
mv -f ../*.dsc ../$aDistr
mv -f ../*.tar.*z ../$aDistr
#mv -f ../*.tar.gz ../$aDistr
#mv -f ../*.tar.xz ../$aDistr
#mv -f ../*.deb ../$aDistr
done

#for aDistr in "${aDistribs[@]}"
#do
# dput ppa:sview/stable ../$aDistr/sview_${aDebVersion}~${aDistr}_source.changes
#done

# turn back to original directory
popd
78 changes: 0 additions & 78 deletions distribution/buildDebSrc_ppa.sh

This file was deleted.

0 comments on commit 0ead28c

Please sign in to comment.