File: deploy.yml

package info (click to toggle)
bettercap 2.33.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 8,668 kB
  • sloc: sh: 154; makefile: 76; python: 52; ansic: 9
file content (116 lines) | stat: -rw-r--r-- 3,900 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
name: Build and Deploy

on:
  push:
    tags:
      - 'v*.*.*'    # Match version tags

jobs:
  build:
    runs-on: ${{ matrix.os }}
    strategy:
      matrix:
        os: [ubuntu-latest, macos-latest, windows-latest]
        go-version: ['1.22.x']
        include:
          - os: ubuntu-latest
            arch: amd64
            target_os: linux
            target_arch: amd64
          - os: ubuntu-latest
            arch: arm64
            target_os: linux
            target_arch: aarch64
          - os: ubuntu-latest
            arch: amd64
            target_os: linux
            target_arch: armhf
            cross_build: true
          - os: macos-latest
            arch: amd64
            target_os: darwin
            target_arch: amd64
          - os: windows-latest
            arch: amd64
            target_os: windows
            target_arch: amd64
            output: bettercap.exe

    env:
      TARGET_OS: ${{ matrix.target_os }}
      TARGET_ARCH: ${{ matrix.target_arch }}
      GO_VERSION: ${{ matrix.go-version }}
      OUTPUT: ${{ matrix.output || 'bettercap' }}

    steps:
    - name: Checkout Code
      uses: actions/checkout@v2

    - name: Set up Go
      uses: actions/setup-go@v2
      with:
        go-version: ${{ matrix.go-version }}

    - name: Install Dependencies
      if: ${{ matrix.os == 'ubuntu-latest' }}
      run: sudo apt-get update && sudo apt-get install -y p7zip-full libpcap-dev libnetfilter-queue-dev libusb-1.0-0-dev

    - name: Install Dependencies (macOS)
      if: ${{ matrix.os == 'macos-latest' }}
      run: brew install libpcap libusb p7zip

    - name: Install Dependencies (Windows)
      if: ${{ matrix.os == 'windows-latest' }}
      run: |
        choco install openssl.light -y
        choco install make -y
        choco install 7zip -y
        choco install pkgconfiglite -y
        mkdir C:\pkg-config
        choco install zadig -y
        curl -L "https://github.com/libusb/libusb/releases/download/v1.0.24/libusb-1.0.24.7z" -o "C:\libusb.7z"
        7z x -y "C:\libusb.7z" -o"C:\libusb"
        curl -L "https://www.winpcap.org/install/bin/WpdPack_4_1_2.zip" -o "C:\wpcap-sdk.zip"
        7z x -y "C:\wpcap-sdk.zip" -o"C:\winpcap"
        copy builder\libusb.pc C:\pkg-config\libusb.pc
        copy builder\libusb.pc C:\pkg-config\libusb-1.0.pc

    - name: Install QEMU for Cross Compilation (Linux only)
      if: matrix.cross_build && matrix.os == 'ubuntu-latest'
      run: |
        wget --show-progress -qcO "qemu.deb" "https://github.com/bettercap/buildutils/raw/main/qemu-user-static_5.2_dfsg-9_amd64.deb"
        sudo dpkg -i "qemu.deb"

    - name: Build
      run: |
        if [ -n "${{matrix.cross_build}}" ]; then
          sudo builder/arm_builder.sh bettercap make -e TARGET="${{ env.OUTPUT }}"
        else
          make -e TARGET="${{ env.OUTPUT }}"
        fi

    - name: Verify Build
      run: |
        file "${{ env.OUTPUT }}"
        openssl dgst -sha256 "${{ env.OUTPUT }}" | tee bettercap_${{ matrix.target_os }}_${{ matrix.target_arch }}_${{ env.VERSION }}.sha256
        7z a "bettercap_${{ matrix.target_os }}_${{ matrix.target_arch }}_${{ env.VERSION }}.zip" "${{ env.OUTPUT }}" "bettercap_${{ matrix.target_os }}_${{ matrix.target_arch }}_${{ env.VERSION }}.sha256"
        ls -la bettercap*

  # Deployment is triggered on push of version tags and the files are already zipped and hashed during the build job.
  deploy:
    needs: [build]
    if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
    name: Release
    runs-on: ubuntu-latest
    steps:
        - name: Checkout Code
          uses: actions/checkout@v2

        - name: Upload Release Assets
          uses: softprops/action-gh-release@v1
          with:
            files: |
                bettercap_*.zip
                bettercap_*.sha256
    env:
        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}