publish-ppa.yml 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. name: Publish to Ubuntu PPA
  2. on:
  3. workflow_dispatch:
  4. inputs:
  5. version:
  6. description: 'Package version (e.g. 2.6.1). Leave empty to use example.env.'
  7. required: false
  8. default: ''
  9. revision:
  10. description: 'Revision for the PPA upload (e.g. 2 for ppa2).'
  11. required: false
  12. default: '1'
  13. permissions:
  14. contents: read
  15. jobs:
  16. publish-ppa:
  17. runs-on: ubuntu-latest
  18. steps:
  19. - name: Checkout repository
  20. uses: actions/checkout@v7
  21. - name: Determine package version
  22. id: version
  23. run: |
  24. EXAMPLE_VERSION=$(grep -E '^\s*VERSION=' example.env | head -n1 | cut -d'=' -f2- | tr -d '"\r' | xargs || true)
  25. if [ -n "${{ github.event.inputs.version }}" ]; then
  26. VERSION="${{ github.event.inputs.version }}"
  27. elif [ -n "$EXAMPLE_VERSION" ]; then
  28. VERSION="$EXAMPLE_VERSION"
  29. else
  30. echo "Unable to determine version"
  31. exit 1
  32. fi
  33. echo "version=$VERSION" >> "$GITHUB_OUTPUT"
  34. - name: Create source tarball
  35. run: |
  36. VERSION="${{ steps.version.outputs.version }}"
  37. PKG_DIR="squidstats-${VERSION}"
  38. mkdir -p build/${PKG_DIR}
  39. rsync -a \
  40. --exclude='.git' \
  41. --exclude='.github' \
  42. --exclude='debian' \
  43. --exclude='.venv' \
  44. --exclude='__pycache__' \
  45. --exclude='*.pyc' \
  46. --exclude='*.session' \
  47. --exclude='.env' \
  48. --exclude='build' \
  49. --exclude='dist' \
  50. ./ build/${PKG_DIR}/
  51. mkdir -p build/tarball
  52. tar -czf \
  53. build/tarball/squidstats_${VERSION}.orig.tar.gz \
  54. -C build \
  55. ${PKG_DIR}
  56. - name: Prepare Debian directory
  57. run: |
  58. cp -r debian build/debian
  59. sed -i 's/debhelper-compat (= 13)/debhelper (>= 12~)/' build/debian/control
  60. sed -i 's/python3 (>= 3\.11)/python3/' build/debian/control
  61. echo "12" > build/debian/compat
  62. - name: Publish to Ubuntu PPA
  63. uses: yuezk/publish-ppa-package@v2
  64. with:
  65. repository: kaelthasmanu/squidstats
  66. gpg_private_key: ${{ secrets.PPA_GPG_PRIVATE_KEY }}
  67. gpg_passphrase: ${{ secrets.PPA_GPG_PASSPHRASE }}
  68. tarball: build/tarball/squidstats_${{ steps.version.outputs.version }}.orig.tar.gz
  69. debian_dir: build/debian
  70. deb_email: manuelalberto.gorrin@gmail.com
  71. deb_fullname: Manuel Alberto Gorrin Reyes
  72. series: "noble"
  73. revision: ${{ github.event.inputs.revision }}
  74. # extra_series: "resolute" # enable once resolute is activated in the PPA settings
  75. debmake_arguments: '-b":python3"'