deb.yml 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  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: debian:sid
  23. steps:
  24. - name: Install git
  25. run: |
  26. apt-get update
  27. apt-get install -y git wget
  28. - name: Checkout codebase
  29. uses: actions/checkout@v2
  30. with:
  31. submodules: "recursive"
  32. - name: Download geo files
  33. run: |
  34. wget -O release/config/geoip.dat "https://raw.githubusercontent.com/v2fly/geoip/release/geoip.dat"
  35. wget -O release/config/geoip-only-cn-private.dat "https://raw.githubusercontent.com/v2fly/geoip/release/geoip-only-cn-private.dat"
  36. wget -O release/config/geosite.dat "https://raw.githubusercontent.com/v2fly/domain-list-community/release/dlc.dat"
  37. - name: Install build dependencies
  38. run: |
  39. apt-get install -y build-essential dh-golang golang-1.17 reprepro
  40. - name: Set environment variable
  41. run: |
  42. echo "PATH=/usr/lib/go-1.17/bin:${PATH}" >> $GITHUB_ENV
  43. - name: Build
  44. run: |
  45. echo "PATH=${PATH}"
  46. cp -r release/debian .
  47. dpkg-buildpackage -us -uc -i -b -d
  48. - name: Copy binary
  49. run: |
  50. cp ../*.deb ./
  51. - name: Upload artifact
  52. uses: actions/upload-artifact@v2
  53. with:
  54. name: v2ray-debian-packages
  55. path: ./*.deb
  56. - name: Setup Repository
  57. if: ${{ github.event_name == 'release' || github.event_name == 'workflow_dispatch' }}
  58. run: |
  59. git clone https://github.com/v2fly/debian.git archive
  60. echo ${{ secrets.DEBIAN_GPG_PRIVATE }} | base64 -d > private.key
  61. gpg --import --batch private.key
  62. gpg -K
  63. cd archive
  64. git config --local user.name "${{ github.actor }}"
  65. git config --local user.email "${{ github.actor }}@users.noreply.github.com"
  66. git remote set-url origin https://${{ github.actor }}:${{ secrets.DEBIAN_REPO_TOKEN }}@github.com/v2fly/debian.git
  67. reprepro includedeb stable ../*.deb
  68. git add -A
  69. git commit -am 'update'
  70. git push origin main