deb.yml 2.1 KB

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