From fd72194a02de47e0259549500f82e982701e0aaf Mon Sep 17 00:00:00 2001 From: Gabriel Carneiro Date: Sat, 23 Nov 2024 11:12:51 -0300 Subject: [PATCH] init commit --- action.yml | 32 ++++++++++++++++++++++++++++++++ entrypoint.sh | 29 +++++++++++++++++++++++++++++ 2 files changed, 61 insertions(+) create mode 100644 action.yml create mode 100644 entrypoint.sh diff --git a/action.yml b/action.yml new file mode 100644 index 0000000..a2d13f4 --- /dev/null +++ b/action.yml @@ -0,0 +1,32 @@ +name: "Deb builder" +description: "Builds .deb packages" +author: "Carneiro" + +inputs: + host: + description: "SSH host address." + default: "${{ secrets.SSH_HOST }}" + port: + description: "SSH port number." + default: ${{ secrets.SSH_PORT }} + username: + description: "SSH username." + default: "${{ secrets.SSH_USERNAME }}" + key: + description: "SSH private key" + default: ${{ secrets.SSH_PRIV_KEY }} + +runs: + using: 'composite' + steps: + - uses: appleboy/ssh-action@v1.2.0 + env: + PKG_NAME: ${{ github.event.repository.name }} + REPO_NAME: ${{ gitea.repository }} + with: + host: ${{ inputs.host }} + username: ${{ inputs.username }} + key: ${{ inputs.key }} + port: ${{ inputs.port }} + envs: PKG_NAME, REPO_NAME + script_file: entrypoint.sh diff --git a/entrypoint.sh b/entrypoint.sh new file mode 100644 index 0000000..0eedff0 --- /dev/null +++ b/entrypoint.sh @@ -0,0 +1,29 @@ +#!/bin/sh + +cd /tmp + +echo $PKG_NAME $REPO_NAME +exit 0 + +echo "Removing old clones..." +rm -rf ./${PKG_NAME} + +echo "Cloning the repo..." +git clone --depth=1 https://git.alice.ufsj.edu.br/${REPO_NAME} + +echo "Removing .git dir..." +rm -rf ./${PKG_NAME}/.git ./${PKG_NAME}/.gitea +ls -la ./${PKG_NAME} + +echo "Building package..." +dpkg-deb --build ${PKG_NAME} + +echo "Moving package to ppa..." +mv ${PKG_NAME}.deb /var/www/html/debian/pool/main +cd /var/www/html/debian + +echo "Creating Packages file..." +dpkg-scanpackages pool/ > dists/stable/main/binary-amd64/Packages + +echo "Creating Relase file..." +apt-ftparchive -c /var/www/html/debian/apt-ftparchive.conf release /var/www/html/debian/dists/stable > /var/www/html/debian/dists/stable/Release