deb.yml 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. name: Build debian packages
  2. on:
  3. push:
  4. branches: [master]
  5. paths:
  6. - "**/*.go"
  7. release:
  8. types: [prereleased]
  9. jobs:
  10. build:
  11. if: github.repository == 'v2fly/v2ray-core'
  12. runs-on: ubuntu-latest
  13. container: debian:sid
  14. steps:
  15. - name: Install git
  16. run: |
  17. apt-get update
  18. apt-get install -y git
  19. - name: Checkout codebase
  20. uses: actions/checkout@v2
  21. with:
  22. submodules: 'recursive'
  23. - name: Install build dependencies
  24. run: |
  25. apt-get install -y build-essential dh-golang golang-any reprepro
  26. - name: Build
  27. run: |
  28. cp -r release/debian .
  29. dpkg-buildpackage -us -uc -i -b
  30. - name: Copy binary
  31. run: |
  32. cp ../*.deb ./
  33. - name: Upload artifact
  34. uses: actions/upload-artifact@v2
  35. with:
  36. name: v2ray-debian-packages
  37. path: ./*.deb
  38. - name: Setup Repository
  39. if: github.event_name == 'release'
  40. run: |
  41. git clone https://github.com/v2fly/debian.git archive
  42. echo ${{ secrets.DEBIAN_GPG_PRIVATE }} | base64 -d > private.key
  43. gpg --import private.key
  44. cd archive
  45. git config --local user.name "${{ github.actor }}"
  46. git config --local user.email "${{ github.actor }}@users.noreply.github.com"
  47. git remote set-url origin https://${{ github.actor }}:${{ secrets.DEBIAN_REPO_TOKEN }}@github.com/v2fly/debian.git
  48. reprepro includedeb stable ../*.deb
  49. git add -A
  50. git commit -am 'update'
  51. git push origin main