build.yml (2584B)
1 --- 2 3 name: Build 4 on: 5 push: 6 tags: 7 - '*' 8 9 jobs: 10 version: 11 name: Extract version 12 runs-on: ubuntu-latest 13 outputs: 14 version: ${{ steps.version.outputs.version }} 15 steps: 16 - name: Extract version 17 id: version 18 run: echo "version=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT 19 20 build: 21 name: Build ${{ matrix.name }} 22 runs-on: ${{ matrix.runs-on }} 23 needs: version 24 strategy: 25 matrix: 26 include: 27 - name: linux-amd64 28 runs-on: ubuntu-latest 29 bin: udphole-linux-amd64 30 cross: false 31 32 - name: linux-arm64 33 runs-on: ubuntu-latest 34 bin: udphole-linux-arm64 35 cross: true 36 arch: aarch64 37 38 - name: linux-armv7 39 runs-on: ubuntu-latest 40 bin: udphole-linux-armv7 41 cross: true 42 arch: armv7 43 44 - name: linux-riscv64 45 runs-on: ubuntu-latest 46 bin: udphole-linux-riscv64 47 cross: true 48 arch: riscv64 49 50 # - name: windows-amd64 51 # runs-on: windows-latest 52 # bin: udphole-windows-amd64.exe 53 # cross: false 54 55 - name: darwin-arm64 56 runs-on: macos-latest 57 bin: udphole-darwin-arm64 58 cross: false 59 60 steps: 61 - uses: actions/checkout@v4 62 63 - if: matrix.runs-on == 'windows-latest' 64 name: Add mingw64 to PATH 65 shell: bash 66 run: | 67 echo "/c/msys64/mingw64/bin" >> $GITHUB_PATH 68 69 - uses: finwo/dep@main 70 name: Install dep 71 72 - name: Install dependencies 73 shell: bash 74 run: dep install 75 76 - if: matrix.cross 77 uses: uraimo/run-on-arch-action@v2 78 name: Build 79 with: 80 arch: ${{ matrix.arch }} 81 distro: ubuntu_latest 82 githubToken: ${{ github.token }} 83 install: | 84 apt-get update -y 85 apt-get install -yq build-essential 86 run: | 87 make -j udphole VERSION=${{ needs.version.outputs.version }} 88 mv udphole ${{ matrix.bin }} 89 90 - if: '!matrix.cross' 91 name: Build 92 shell: bash 93 run: | 94 make -j udphole VERSION=${{ needs.version.outputs.version }} 95 mv udphole ${{ matrix.bin }} 96 97 - name: Upload to release 98 uses: svenstaro/upload-release-action@v2 99 with: 100 repo_token: ${{ secrets.GITHUB_TOKEN }} 101 file: ${{ matrix.bin }} 102 file_glob: false 103 overwrite: true 104 tag: ${{ github.ref }}