From 2e9df5cac16d291e85b3b114dde51bfe032db188 Mon Sep 17 00:00:00 2001 From: Mzack9999 Date: Thu, 4 Jun 2020 02:50:19 +0200 Subject: [PATCH] updated actions and dockerfile --- .../workflows/push-binaries-on-release.yml | 57 ------------------- .github/workflows/release.yml | 25 ++++++++ .goreleaser.yml | 21 +++++++ Dockerfile | 4 -- 4 files changed, 46 insertions(+), 61 deletions(-) delete mode 100644 .github/workflows/push-binaries-on-release.yml create mode 100644 .github/workflows/release.yml create mode 100644 .goreleaser.yml diff --git a/.github/workflows/push-binaries-on-release.yml b/.github/workflows/push-binaries-on-release.yml deleted file mode 100644 index e607e38..0000000 --- a/.github/workflows/push-binaries-on-release.yml +++ /dev/null @@ -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-*' diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..d9c4eaf --- /dev/null +++ b/.github/workflows/release.yml @@ -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}} \ No newline at end of file diff --git a/.goreleaser.yml b/.goreleaser.yml new file mode 100644 index 0000000..47d83c7 --- /dev/null +++ b/.goreleaser.yml @@ -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 \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index f250eb3..b03ce55 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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