Create tiny-dfr package #19
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
name: Create tiny-dfr package | |
on: | |
workflow_dispatch: | |
jobs: | |
Publish: | |
runs-on: ubuntu-latest | |
steps: | |
- name: 'Checkout Repo' | |
uses: actions/checkout@v3 | |
with: | |
persist-credentials: false | |
fetch-depth: 0 | |
- name: Configure GPG Key | |
run: | | |
echo -n "$GPG_SIGNING_KEY" | base64 -di | gpg --import | |
env: | |
GPG_SIGNING_KEY: ${{ secrets.GPG_SIGNING_KEY }} | |
- name: Get the source code | |
id: publish | |
run: | | |
COMMIT_HASH=590b5044332f047565367b74cc9494207df849a3 | |
VERSION=0.1.2-3 | |
sudo apt update -y | |
sudo apt upgrade -y | |
sudo apt-get install -y gir1.2-coglpango-1.0 gir1.2-pango-1.0 libcogl-pango-dev libghc-gi-pango-dev \ | |
libghc-pango-dev libghc-yi-frontend-pango-dev libpango1.0-dev libudev-dev libinput-dev | |
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
git config --global user.name "github-actions[bot]" | |
git clone https://github.com/AdityaGarg8/tiny-dfr.git | |
cd tiny-dfr | |
git checkout ${COMMIT_HASH} | |
cp ${{ github.workspace }}/.github/patches/*.patch ./ | |
git am ./*.patch | |
cargo b --release | |
mkdir deb | |
cd deb | |
mkdir usr | |
cd usr | |
mkdir bin | |
cd .. | |
cd .. | |
cp -r ./etc ./deb | |
cp -r ./share ./deb/usr | |
cp ./target/release/tiny-dfr ./deb/usr/bin | |
cd deb | |
mkdir DEBIAN | |
cd DEBIAN | |
echo "Package: tiny-dfr" > control | |
echo "Version: ${VERSION}" >> control | |
echo "Maintainer: Aditya Garg" >> control | |
echo "Architecture: amd64" >> control | |
echo "Description: Function row daemon for touchbar on Macs" >> control | |
echo "Depends: systemd" >> control | |
#echo "if [ -f /etc/tiny-dfr.conf ]" > preinst | |
#echo "then" >> preinst | |
#echo "cp /etc/tiny-dfr.conf /etc/tiny-dfr.conf.orj" >> preinst | |
#echo "fi" >> preinst | |
echo "systemctl enable --now tiny-dfr.service" > postinst | |
#echo "if [ -f /etc/tiny-dfr.conf.orj ]" >> postinst | |
#echo "then" >> postinst | |
#echo "echo \"Configuration file of the previous installation have been saved to /etc/tiny-dfr.conf.orj. You may refer to that to modify your new config\"" >> postinst | |
#echo "fi" >> postinst | |
echo "systemctl disable --now tiny-dfr.service" > prerm | |
#chmod 755 ./preinst | |
chmod 755 ./postinst | |
chmod 755 ./prerm | |
cd ${{ github.workspace }}/tiny-dfr | |
dpkg-deb --build --root-owner-group -Zgzip deb | |
mv ./deb.deb ${{ github.workspace }} | |
cd ${{ github.workspace }} | |
# Packages & Packages.gz | |
dpkg-name ./deb.deb | |
dpkg-scanpackages --multiversion . > Packages | |
gzip -k -f Packages | |
# Release, Release.gpg & InRelease | |
apt-ftparchive release . > Release | |
gpg --default-key "${GPG_SIGNING_EMAIL}" -abs -o - Release > Release.gpg | |
gpg --default-key "${GPG_SIGNING_EMAIL}" --clearsign -o - Release > InRelease | |
cd ${{ github.workspace }} | |
rm -r ./tiny-dfr | |
git add . | |
git commit -m "Update tiny-dfr to ${VERSION}" | |
env: | |
GPG_SIGNING_EMAIL: ${{ secrets.GPG_SIGNING_EMAIL }} | |
- name: Push changes to the repo | |
uses: ad-m/github-push-action@master | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
branch: ${{ github.ref }} |