publish-ppa.yml 3.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. name: Publish to Ubuntu PPA
  2. on:
  3. workflow_dispatch:
  4. inputs:
  5. version:
  6. description: 'Package version (e.g. 2.4). Leave empty to use example.env.'
  7. required: false
  8. default: ''
  9. permissions:
  10. contents: read
  11. jobs:
  12. publish-ppa:
  13. name: Publish to PPA
  14. runs-on: ubuntu-latest
  15. steps:
  16. # ── 1. Checkout ──────────────────────────────────────────────────────
  17. - name: Checkout repository
  18. uses: actions/checkout@v6
  19. with:
  20. fetch-depth: 0
  21. # ── 2. Resolve package version ──────────────────────────────────────
  22. - name: Determine package version
  23. id: version
  24. run: |
  25. EXAMPLE_VERSION=$(grep -E '^\s*VERSION=' example.env | head -n1 | cut -d'=' -f2- | tr -d '"\r' | xargs || true)
  26. if [ -n "${{ github.event.inputs.version }}" ]; then
  27. VERSION="${{ github.event.inputs.version }}"
  28. elif [ -n "$EXAMPLE_VERSION" ]; then
  29. VERSION="$EXAMPLE_VERSION"
  30. else
  31. VERSION="0.0.0"
  32. fi
  33. echo "version=${VERSION}" >> "$GITHUB_OUTPUT"
  34. echo "Package version: ${VERSION}"
  35. # ── 3. Create source tarball ─────────────────────────────────────────
  36. - name: Create source tarball
  37. run: |
  38. VERSION="${{ steps.version.outputs.version }}"
  39. PKG_DIR="squidstats-${VERSION}"
  40. mkdir -p "ppa-build/${PKG_DIR}"
  41. rsync -a \
  42. --exclude='.git' \
  43. --exclude='debian' \
  44. --exclude='.github' \
  45. --exclude='.venv' \
  46. --exclude='__pycache__' \
  47. --exclude='*.pyc' \
  48. --exclude='*.session' \
  49. --exclude='.env' \
  50. --exclude='ppa-build' \
  51. --exclude='dist' \
  52. ./ "ppa-build/${PKG_DIR}/"
  53. mkdir -p ppa-build/tarball
  54. tar -czf "ppa-build/tarball/squidstats_${VERSION}.orig.tar.gz" \
  55. -C ppa-build "${PKG_DIR}"
  56. echo "=== Created tarball ==="
  57. ls -lh ppa-build/tarball/
  58. # ── 4. Prepare debian directory for PPA ─────────────────────────────
  59. # The action container runs Ubuntu focal (debhelper 12, python3 3.8).
  60. # Relax Build-Depends so mk-build-deps can install them inside the
  61. # container; the actual package is built on Launchpad servers (noble/
  62. # resolute) which have debhelper 13+ and python3 3.11+.
  63. - name: Prepare debian directory for PPA
  64. run: |
  65. cp -r debian ppa-debian
  66. sed -i 's/debhelper-compat (= 13)/debhelper (>= 12~)/' ppa-debian/control
  67. sed -i 's/python3 (>= 3\.11)/python3/' ppa-debian/control
  68. echo "12" > ppa-debian/compat
  69. echo "=== Build-Depends after fix ==="
  70. grep 'Build-Depends' ppa-debian/control
  71. # ── 5. Publish to PPA ────────────────────────────────────────────────
  72. - name: Publish to Ubuntu PPA
  73. uses: yuezk/publish-ppa-package@v2
  74. with:
  75. repository: kaelthasmanu/squidstats
  76. gpg_private_key: ${{ secrets.PPA_GPG_PRIVATE_KEY }}
  77. gpg_passphrase: ${{ secrets.PPA_GPG_PASSPHRASE }}
  78. tarball: ppa-build/tarball/squidstats_${{ steps.version.outputs.version }}.orig.tar.gz
  79. debian_dir: ppa-debian
  80. deb_email: manuelalberto.gorrin@gmail.com
  81. deb_fullname: Manuel Alberto Gorrin Reyes
  82. series: "noble"
  83. # extra_series: "resolute" # enable once resolute is activated in the PPA settings
  84. debmake_arguments: '-b":python3"'