subfinder/.github/workflows/push-binaries-on-release.yml

58 lines
1.7 KiB
YAML

# push-binaries-onrelease cross compiles the subfinder binary,
# tars the files and uploads them to the release.
name: Cross compile binaries and attach to release
on:
release:
types: [published]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Set up Go 1.13.5
uses: actions/setup-go@v1
with:
go-version: 1.13.5
id: go
- name: Check out code into the Go module directory
uses: actions/checkout@v1
- name: Get dependencies
run: |
mkdir -p $(go env GOPATH)/bin
go get -v -t -d ./...
if [ -f Gopkg.toml ]; then
curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh
dep ensure
fi
- name: Build the tar archives
run: |
platforms=("windows/amd64" "linux/amd64" "darwin/amd64")
for platform in "${platforms[@]}"
do
platform_split=(${platform//\// })
GOOS=${platform_split[0]}
GOARCH=${platform_split[1]}
output_name=subfinder'-'$GOOS'-'$GOARCH
if [ $GOOS = "windows" ]; then
output_name+='.exe'
fi
env GOOS=$GOOS GOARCH=$GOARCH go build -o $output_name github.com/projectdiscovery/subfinder/cmd/subfinder
if [ $? -ne 0 ]; then
echo 'An error has occurred! Aborting the script execution...'
exit 1
fi
tar -czvf $output_name.tar $output_name
rm $output_name
done
- name: Publish the binaries to the release
uses: skx/github-action-publish-binaries@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
args: 'subfinder-*'