deb.yml 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. name: Build debian packages
  2. on:
  3. workflow_dispatch:
  4. push:
  5. branches:
  6. - master
  7. - v*
  8. paths:
  9. - ".github/workflows/deb.yml"
  10. - "release/debian/*"
  11. pull_request:
  12. types: [opened, synchronize, reopened]
  13. paths:
  14. - ".github/workflows/deb.yml"
  15. - "release/debian/*"
  16. release:
  17. types: [prereleased]
  18. jobs:
  19. package:
  20. if: github.repository == 'v2fly/v2ray-core'
  21. runs-on: ubuntu-latest
  22. container: golang:1.17-bullseye
  23. steps:
  24. - name: Update & install dependencies
  25. run: |
  26. apt-get update
  27. apt-get install -y git wget
  28. - name: Checkout codebase
  29. uses: actions/checkout@v3
  30. - name: Download geo files
  31. run: |
  32. wget -O release/config/geoip.dat "https://raw.githubusercontent.com/v2fly/geoip/release/geoip.dat"
  33. wget -O release/config/geoip-only-cn-private.dat "https://raw.githubusercontent.com/v2fly/geoip/release/geoip-only-cn-private.dat"
  34. wget -O release/config/geosite.dat "https://raw.githubusercontent.com/v2fly/domain-list-community/release/dlc.dat"
  35. - name: Install build dependencies
  36. run: |
  37. apt-get install -y build-essential dh-golang reprepro
  38. - name: Build
  39. run: |
  40. echo "PATH=${PATH}"
  41. cp -r release/debian .
  42. dpkg-buildpackage -us -uc -i -b -d
  43. - name: Copy binary
  44. run: |
  45. cp ../*.deb ./
  46. - name: Upload artifact
  47. uses: actions/upload-artifact@v2
  48. with:
  49. name: v2ray-debian-packages
  50. path: ./*.deb
  51. - name: Setup Repository
  52. if: ${{ github.event_name == 'release' || github.event_name == 'workflow_dispatch' }}
  53. run: |
  54. git clone https://github.com/v2fly/debian.git archive
  55. echo ${{ secrets.DEBIAN_GPG_PRIVATE }} | base64 -d > private.key
  56. gpg --import --batch private.key
  57. gpg -K
  58. cd archive
  59. git config --local user.name "${{ github.actor }}"
  60. git config --local user.email "${{ github.actor }}@users.noreply.github.com"
  61. git remote set-url origin https://${{ github.actor }}:${{ secrets.DEBIAN_REPO_TOKEN }}@github.com/v2fly/debian.git
  62. reprepro includedeb stable ../*.deb
  63. git add -A
  64. git commit -am 'update'
  65. git push origin main