Skip to content

🎉 Build Binary

🎉 Build Binary #40

Workflow file for this run

name: 🎉 Build Binary
on:
create:
tags:
- v*
workflow_dispatch:
jobs:
build:
name: Build
runs-on: ${{ matrix.os }}
strategy:
matrix:
os:
- ubuntu-20.04
- macos-13
- macos-14
steps:
- name: Set up Go 1.17
uses: actions/setup-go@v1
with:
go-version: 1.17
id: go
- name: Set up libpcap-dev
if: matrix.os == 'ubuntu-20.04'
run: sudo apt-get install libpcap-dev gcc -y
- name: Get version
id: get_version
run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//}
- name: Check out code into the Go module directory
uses: actions/checkout@v2
- name: Get dependencies
run: go mod download
- name: Build On Linux
run: |
go build -o ./ksubdomain ./cmd/ksubdomain/
chmod +x ksubdomain
tar -cvf KSubdomain-${{ steps.get_version.outputs.VERSION }}-linux-amd64.tar ksubdomain
if: matrix.os == 'ubuntu-20.04'
env:
GOENABLE: 1
CGO_LDFLAGS: "-Wl,-static -L/usr/lib/x86_64-linux-gnu/libpcap.a -lpcap -Wl,-Bdynamic"
- name: Build On Darwin amd64
run: |
go build -o ./ksubdomain ./cmd/ksubdomain/
chmod +x ksubdomain
tar -cvf KSubdomain-${{ steps.get_version.outputs.VERSION }}-darwin-amd64.tar ksubdomain
if: matrix.os == 'macos-13'
env:
GOOS: darwin
GOARCH: amd64
- name: Build On Darwin arm64
run: |
go build -o ./ksubdomain ./cmd/ksubdomain/
chmod +x ksubdomain
tar -cvf KSubdomain-${{ steps.get_version.outputs.VERSION }}-darwin-arm64.tar ksubdomain
if: matrix.os == 'macos-14'
env:
GOOS: darwin
GOARCH: arm64
- name: Build On Windows
run: |
go build -o ./ksubdomain.exe ./cmd/ksubdomain/
tar -cvf KSubdomain-windows.tar ksubdomain.exe
if: matrix.os == 'ubuntu-20.04'
env:
GOOS: windows
GOENABLE: 1
- name: Release
uses: softprops/action-gh-release@master
with:
# note you'll typically need to create a personal access token
# with permissions to create releases in the other repo
files: KSubdomain-*
fail_on_unmatched_files: true
token: ${{ secrets.TOKEN }}
append_body: true
env:
GITHUB_REPOSITORY: boy-hack/ksubdomain