From c121c374f6e6f1a54f678fe981042539b5d0bfbf Mon Sep 17 00:00:00 2001 From: Rem01Gaming Date: Mon, 9 Sep 2024 19:31:13 +0700 Subject: [PATCH] workflows: Move DEB package build script here Signed-off-by: Rem01Gaming --- .github/workflows/pack-deb.yml | 99 ++++++++++++++++++---------------- Makefile | 25 --------- 2 files changed, 54 insertions(+), 70 deletions(-) diff --git a/.github/workflows/pack-deb.yml b/.github/workflows/pack-deb.yml index d5ade07..78e9e15 100644 --- a/.github/workflows/pack-deb.yml +++ b/.github/workflows/pack-deb.yml @@ -1,46 +1,55 @@ -name: Build DEB Package - -on: - workflow_dispatch: - push: - branches: - - main - paths: - - '.github/workflows/pack-deb.yml' - - 'src/**' - - 'share/**' - - 'dpkg-conf/**' - - 'Makefile' - -jobs: - build: - name: Build DEB package - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - name: dpkg compile - working-directory: ./ - run: make pack-deb - - name: Upload artifact - uses: actions/upload-artifact@v4 - with: - name: origami-kernel.deb - path: ./ - - name: Upload to telegram - env: - CHAT_ID: ${{ secrets.CHAT_ID }} - BOT_TOKEN: ${{ secrets.BOT_TOKEN }} - COMMIT_MESSAGE: ${{ github.event.head_commit.message }} - COMMIT_URL: ${{ github.event.head_commit.url }} - RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} - TITLE: OKM DEB Package - run: | - DEB="okm-$(git rev-list HEAD --count)-$(git rev-parse --short HEAD)-gh.deb" - mv origami-kernel.deb $DEB - if [ ! -z "${{ secrets.BOT_TOKEN }}" ]; then - export VERSION=$(git rev-list --count HEAD) - bash $GITHUB_WORKSPACE/.github/scripts/telegram_bot.sh $GITHUB_WORKSPACE/$DEB +name: Build DEB Package + +on: + workflow_dispatch: + push: + branches: + - main + paths: + - '.github/workflows/pack-deb.yml' + - 'src/**' + - 'share/**' + - 'dpkg-conf/**' + +jobs: + build: + name: Build DEB package + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: dpkg compile + working-directory: ./ + run: | + mkdir -pv ./out/deb/data/data/com.termux/files/usr/bin + mkdir -pv ./out/deb/data/data/com.termux/files/usr/share/origami-kernel + cp -rv share/* ./out/deb/data/data/com.termux/files/usr/share/origami-kernel + cp -rv src/* ./out/deb/data/data/com.termux/files/usr/bin + cp -rv dpkg-conf ./out/deb/DEBIAN + sed -i "s/^Version: .*/Version: $(cat share/version)-$(shell git rev-list HEAD --count)+$(shell git rev-parse --short HEAD)/" ./out/deb/DEBIAN/control + chmod -Rv 755 ./out/deb/DEBIAN + chmod -Rv 755 ./out/deb/data/data/com.termux/files/usr/bin + chmod -Rv 777 ./out/deb/data/data/com.termux/files/usr/bin/* + cd ./out/deb && dpkg -b . ../../origami-kernel.deb + - name: Upload artifact + uses: actions/upload-artifact@v4 + with: + name: origami-kernel.deb + path: ./ + - name: Upload to telegram + env: + CHAT_ID: ${{ secrets.CHAT_ID }} + BOT_TOKEN: ${{ secrets.BOT_TOKEN }} + COMMIT_MESSAGE: ${{ github.event.head_commit.message }} + COMMIT_URL: ${{ github.event.head_commit.url }} + RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} + TITLE: OKM DEB Package + run: | + DEB="okm-$(git rev-list HEAD --count)-$(git rev-parse --short HEAD)-gh.deb" + mv origami-kernel.deb $DEB + if [ ! -z "${{ secrets.BOT_TOKEN }}" ]; then + export VERSION=$(git rev-list --count HEAD) + bash $GITHUB_WORKSPACE/.github/scripts/telegram_bot.sh $GITHUB_WORKSPACE/$DEB fi \ No newline at end of file diff --git a/Makefile b/Makefile index 06277a3..9aa82d7 100644 --- a/Makefile +++ b/Makefile @@ -53,28 +53,3 @@ install-dependence: @apt install root-repo -y @apt install fzf fzy git jq sqlite -y @echo "\033[1;38;2;254;228;208m[+] Dependencies installed\033[0m" - -pack-deb: - @mkdir -v $(O) - @mkdir -v $(O)/deb - @mkdir -pv $(O)/deb/data/data/com.termux/files/usr - @mkdir -pv $(O)/deb/data/data/com.termux/files/usr/bin/ - @mkdir -pv $(O)/deb/data/data/com.termux/files/usr/share/origami-kernel/ - @cp -rv share/* $(O)/deb/data/data/com.termux/files/usr/share/origami-kernel/ - @cp -rv src/* $(O)/deb/data/data/com.termux/files/usr/bin/ - @cp -rv dpkg-conf $(O)/deb/DEBIAN - sed -i "s/^Version: .*/Version: $(VERSION)-$(VERSION_CODE)+$(COMMIT_HASH)/" $(O)/deb/DEBIAN/control - @printf "\033[1;38;2;254;228;208m[*] Build packages...\033[0m\n" - @chmod -Rv 755 $(O)/deb/DEBIAN - @chmod -Rv 755 $(O)/deb/data/data/com.termux/files/usr/bin - @chmod -Rv 777 $(O)/deb/data/data/com.termux/files/usr/bin/okm - @chmod -Rv 777 $(O)/deb/data/data/com.termux/files/usr/bin/okm-sudo - @cd $(O)/deb&&dpkg -b . ../../origami-kernel.deb - @printf "\033[1;38;2;254;228;208m .^. .^.\n" - @printf " /⋀\\_ノ_/⋀\\ \n" - @printf " /ノソノ\\ノソ丶)|\n" - @printf " |ルリリ >  )リ\n" - @printf " ノノ㇏ V ノ|ノ\n" - @printf " ⠁⠁\n" - @printf "\033[1;38;2;254;228;208m[+] Build done, Package: ./origami-kernel.deb\033[0m\n" - @rm -rf ./out