feat: add Debian package building to CI pipeline and local build
All checks were successful
CI/CD / lint (push) Successful in 47s
CI/CD / typecheck (push) Successful in 47s
CI/CD / test (push) Successful in 59s
CI/CD / build (push) Successful in 3m59s
CI/CD / publish-rpm (push) Successful in 38s
CI/CD / publish-deb (push) Successful in 29s
CI/CD / smoke (push) Successful in 8m23s

Support DEB packaging alongside RPM for Debian trixie (13/stable),
forky (14/testing), Ubuntu noble (24.04 LTS), and plucky (25.04).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Michal
2026-03-09 22:43:40 +00:00
parent 3088a17ac0
commit 9c479e5615
6 changed files with 203 additions and 1 deletions

View File

@@ -300,6 +300,9 @@ jobs:
- name: Package RPM
run: nfpm pkg --packager rpm --target dist/
- name: Package DEB
run: nfpm pkg --packager deb --target dist/
- name: Upload RPM artifact
uses: actions/upload-artifact@v3
with:
@@ -307,6 +310,13 @@ jobs:
path: dist/mcpctl-*.rpm
retention-days: 7
- name: Upload DEB artifact
uses: actions/upload-artifact@v3
with:
name: deb-package
path: dist/mcpctl*.deb
retention-days: 7
# ── Release pipeline (main branch push only) ──────────────
# NOTE: Docker image builds + deploy happen via `bash fulldeploy.sh`
# (not CI) because the runner containers lack the privileged access
@@ -363,3 +373,55 @@ jobs:
# Link package to repo
source scripts/link-package.sh
link_package "rpm" "mcpctl"
publish-deb:
runs-on: ubuntu-latest
needs: [build]
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
steps:
- uses: actions/checkout@v4
- name: Download DEB artifact
uses: actions/download-artifact@v3
with:
name: deb-package
path: dist/
- name: Publish DEB to Gitea
env:
GITEA_TOKEN: ${{ secrets.PACKAGES_TOKEN }}
GITEA_URL: http://${{ env.GITEA_REGISTRY }}
GITEA_OWNER: ${{ env.GITEA_OWNER }}
GITEA_REPO: mcpctl
run: |
DEB_FILE=$(ls dist/mcpctl*.deb | head -1)
DEB_VERSION=$(dpkg-deb --field "$DEB_FILE" Version)
echo "Publishing $DEB_FILE (version $DEB_VERSION)..."
# Publish to each supported distribution
# Debian: trixie (13/stable), forky (14/testing)
# Ubuntu: noble (24.04 LTS), plucky (25.04)
DISTRIBUTIONS="trixie forky noble plucky"
for DIST in $DISTRIBUTIONS; do
echo " -> $DIST..."
HTTP_CODE=$(curl -s -o /dev/null -w "%{http_code}" \
-X PUT \
-H "Authorization: token ${GITEA_TOKEN}" \
--upload-file "$DEB_FILE" \
"${GITEA_URL}/api/packages/${GITEA_OWNER}/debian/pool/${DIST}/main/upload")
if [ "$HTTP_CODE" = "201" ] || [ "$HTTP_CODE" = "200" ]; then
echo " Published to $DIST"
elif [ "$HTTP_CODE" = "409" ]; then
echo " Already exists in $DIST (skipping)"
else
echo " WARNING: Upload to $DIST returned HTTP $HTTP_CODE"
fi
done
echo "Published successfully!"
# Link package to repo
source scripts/link-package.sh
link_package "debian" "mcpctl"