Compare commits
21 commits
Author | SHA1 | Date | |
---|---|---|---|
aa12d23858 | |||
ac5e859977 | |||
0a7a3f70eb | |||
063ea9b64b | |||
409ad256f0 | |||
2ad4a88382 | |||
dd5ee5c832 | |||
a5db9d457d | |||
b7aaf2253b | |||
d55391bf15 | |||
5524987beb | |||
bf1e27cad3 | |||
f1a0ef62d2 | |||
bcb21618a2 | |||
0951031c35 | |||
4d52e80b0f | |||
d95c49a1c4 | |||
25af0cff8b | |||
d6890b19e3 | |||
d72596fe04 | |||
7c218fc664 |
4 changed files with 74 additions and 2 deletions
71
.forgejo/workflows/build.yml
Normal file
71
.forgejo/workflows/build.yml
Normal file
|
@ -0,0 +1,71 @@
|
||||||
|
name: Build and Publish Debian Package
|
||||||
|
|
||||||
|
#on: [push]
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
tags:
|
||||||
|
- "v*"
|
||||||
|
|
||||||
|
env:
|
||||||
|
DISTRIBUTION: bookworm
|
||||||
|
COMPONENT: 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 magicfw.py as the executable and rename if needed
|
||||||
|
cp src/magicfw.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: Generate version number
|
||||||
|
run: |
|
||||||
|
VERSION=$(git describe --tags --abbrev=0 2>/dev/null || echo "0.1.$(git rev-list --count HEAD)")
|
||||||
|
echo "VERSION=$VERSION" >> $GITHUB_ENV
|
||||||
|
|
||||||
|
- 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-docker -v $VERSION -C package .
|
||||||
|
|
||||||
|
- name: Upload to Forgejo Debian Registry
|
||||||
|
env:
|
||||||
|
FORGEJO_TOKEN: ${{ secrets.FORGEJO_TOKEN }}
|
||||||
|
run: |
|
||||||
|
PACKAGE_NAME="magicfw-docker_${VERSION}_amd64.deb" # Update version accordingly
|
||||||
|
|
||||||
|
curl --user "your_username:$FORGEJO_TOKEN" \
|
||||||
|
--upload-file ./${PACKAGE_NAME} \
|
||||||
|
"https://git.marcorealacci.me/api/packages/${{ github.repository_owner }}/debian/pool/${{env.DISTRIBUTION}}/${{env.COMPONENT}}/upload"
|
|
@ -1,4 +1,4 @@
|
||||||
# Docker Magic Firewall Service: README.md
|
# Docker Magic Firewall Service
|
||||||
|
|
||||||
## Project Overview
|
## Project Overview
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
#!/usr/bin/env python
|
||||||
import os
|
import os
|
||||||
import json
|
import json
|
||||||
import logging
|
import logging
|
|
@ -10,7 +10,7 @@ StartLimitBurst=10
|
||||||
Type=exec
|
Type=exec
|
||||||
Restart=on-failure
|
Restart=on-failure
|
||||||
RestartSec=5s
|
RestartSec=5s
|
||||||
ExecStart=/usr/bin/python3 /opt/docker_magicfw.py
|
ExecStart=/usr/local/bin/magicfw
|
||||||
|
|
||||||
# Environment variables (customize as needed)
|
# Environment variables (customize as needed)
|
||||||
Environment=LOG_LEVEL=INFO
|
Environment=LOG_LEVEL=INFO
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue