deb.yml 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  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/debian/*"
  12. release:
  13. types: [prereleased]
  14. jobs:
  15. package:
  16. if: github.repository == 'v2fly/v2ray-core'
  17. runs-on: ubuntu-latest
  18. container: debian:sid
  19. steps:
  20. - name: Install git
  21. run: |
  22. apt-get update
  23. apt-get install -y git wget
  24. - name: Checkout codebase
  25. uses: actions/checkout@v2
  26. with:
  27. submodules: "recursive"
  28. - name: Download geo files
  29. run: |
  30. wget -O release/config/geoip.dat "https://raw.githubusercontent.com/v2fly/geoip/release/geoip.dat"
  31. wget -O release/config/geosite.dat "https://raw.githubusercontent.com/v2fly/domain-list-community/release/dlc.dat"
  32. - name: Install build dependencies
  33. run: |
  34. apt-get install -y build-essential dh-golang golang-1.16 reprepro
  35. - name: Set environment variable
  36. run: |
  37. echo "PATH=/usr/lib/go-1.16/bin:${PATH}" >> $GITHUB_ENV
  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'
  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