docker-magic-firewall/.forgejo/workflows/build.yml
marcorealacci dd5ee5c832
All checks were successful
Build and Publish Debian Package / build (push) Successful in 39s
Aggiorna .forgejo/workflows/build.yml
2025-03-15 02:37:29 +01:00

68 lines
No EOL
2 KiB
YAML

name: Build and Publish Debian Package
#on: [push]
on:
push:
branches:
- main
- test
pull_request:
branches:
- main
jobs:
build:
runs-on: docker
container:
image: catthehacker/ubuntu:act-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
# - name: Debug file structure
# run: ls -R
# - name: Debug pwd
# run: pwd
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.13'
- name: Install FPM dependencies
run: |
sudo apt-get update
sudo apt-get install -y ruby ruby-dev build-essential
sudo gem install --no-document fpm
- name: Prepare package structure
run: |
# Create temporary packaging directory
mkdir -p package/usr/local/bin
mkdir -p package/etc/systemd/system
# Copy main.py as the executable and rename if needed
cp src/main.py package/usr/local/bin/magicfw
chmod +x package/usr/local/bin/magicfw
# Copy the systemd service file
cp systemd/magicfw.service package/etc/systemd/system/
- name: Build Debian package with FPM
run: |
# The -s dir option tells FPM the source is a directory.
# The -t deb option builds a deb package.
# -n is the package name and -v the version.
fpm -s dir -t deb -n magicfw -v 1.0.0 -C package .
# - name: Upload to Forgejo Debian Registry
# env:
# FORGEJO_TOKEN: ${{ secrets.FORGEJO_TOKEN }}
# run: |
# PACKAGE_NAME="@magicfw_1.0.0_amd64.deb" # Update version accordingly
# DISTRO="debian" # e.g., bullseye, bookworm
# COMPONENT="main"
# curl --user "your_username:$FORGEJO_TOKEN" \
# --upload-file ../${PACKAGE_NAME} \
# "https://git.marcorealacci.me/api/packages/${{ github.repository_owner }}/debian/pool/${DISTRO}/${COMPONENT}/${PACKAGE_NAME}"