docker-magic-firewall/.forgejo/workflows/build-debian-package.yml

67 lines
2.2 KiB
YAML
Raw Normal View History

2025-01-28 19:02:32 +01:00
name: Build and Deploy Debian Package
on:
push:
tags:
- '*'
jobs:
build-package:
runs-on: docker
container:
2025-01-28 19:15:24 +01:00
image: catthehacker/ubuntu:act-latest
2025-01-28 19:02:32 +01:00
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Parse distribution
run: |
if [[ "$GITHUB_REF_NAME" == *"@stable"* ]]; then
echo "DISTRO=stable" >> $GITHUB_ENV
else
echo "DISTRO=unstable" >> $GITHUB_ENV
fi
- name: Setup Debian Packaging
run: |
sudo apt-get update
2025-01-28 19:17:36 +01:00
sudo apt-get install -y devscripts debhelper dh-python dpkg-dev jq build-essential
2025-01-28 19:02:32 +01:00
2025-01-28 19:25:11 +01:00
- name: Generate dynamic changelog
run: |
2025-01-28 19:32:04 +01:00
VERSION=${{ github.ref_name#v }} # Rimuove il prefisso "v" dal tag
DISTRIBUTION=$DISTRO # Dalla variabile impostata in "Parse distribution"
# Configura dch per generare il changelog
dch --create \
--package magicfw \
--newversion "$VERSION" \
--distribution "$DISTRIBUTION" \
"Automatic release from Git tag ${GITHUB_REF_NAME}"
# Debug: Mostra il contenuto del changelog generato
cat debian/changelog
# - name: Generate dynamic changelog
# run: |
# mkdir -p debian # Ensure the debian directory exists
# sed -e "s/{{VERSION}}/${{ steps.version.outputs.DEB_VERSION }}/g" \
# -e "s/{{TAG}}/$GITHUB_REF_NAME/g" \
# debian/changelog.in > debian/changelog
# cat debian/changelog # Debugging: Print the generated changelog
2025-01-28 19:25:11 +01:00
2025-01-28 19:02:32 +01:00
- name: Build Debian Package
run: |
debuild -us -uc -b
- name: Upload to Forgejo Debian Registry
env:
FORGEJO_TOKEN: ${{ secrets.FORGEJO_TOKEN }}
run: |
PACKAGE_NAME="magicfw_0.1.0-1_all.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}"