updated actions and dockerfile

master
Mzack9999 2020-06-04 02:50:19 +02:00
parent 5c31747170
commit 2e9df5cac1
4 changed files with 46 additions and 61 deletions

View File

@ -1,57 +0,0 @@
# 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-*'

25
.github/workflows/release.yml vendored Normal file
View File

@ -0,0 +1,25 @@
name: Release
on:
create:
tags:
- v*
jobs:
release:
name: Release on GitHub
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v1
- name: Validates GO releaser config
uses: docker://goreleaser/goreleaser:latest
with:
args: check
- name: Create release on GitHub
uses: docker://goreleaser/goreleaser:latest
with:
args: release
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}

21
.goreleaser.yml Normal file
View File

@ -0,0 +1,21 @@
builds:
- binary: subfinder
main: cmd/subfinder/main.go
goos:
- linux
- windows
- darwin
goarch:
- amd64
- 386
- arm
- arm64
archives:
- id: tgz
format: tar.gz
replacements:
darwin: macOS
format_overrides:
- goos: windows
format: zip

View File

@ -5,10 +5,6 @@ RUN apk add --no-cache --upgrade git openssh-client ca-certificates
RUN go get -u github.com/golang/dep/cmd/dep
WORKDIR /go/src/app
# Cache the dependencies early
COPY Gopkg.toml Gopkg.lock ./
RUN dep ensure -vendor-only -v
# Install
RUN go get -u github.com/projectdiscovery/subfinder/cmd/subfinder