deb.yml 2.2 KB

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