deb.yml 2.3 KB

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