Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Builds binaries for platforms and draft a GitHub release #503

Merged
merged 10 commits into from
Aug 3, 2021
40 changes: 40 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Copyright 2021 ZUP IT SERVICOS EM TECNOLOGIA E INOVACAO SA
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

name: Release

on:
push:
tags:
- '*'

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: "Checkout"
uses: actions/checkout@v2

- name: "Set up Go"
uses: actions/setup-go@v2
with:
go-version: '^1.16'

- name: "Build and publish"
uses: goreleaser/goreleaser-action@v2
with:
version: latest
args: release --rm-dist
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,4 @@ horusec-analysis-*.json
cmd/horusec/start/examples/
vendor
obj/
/dist
4 changes: 3 additions & 1 deletion config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ import (
"github.com/ZupIT/horusec/internal/utils/valueordefault"
)

var version = "{{VERSION_NOT_FOUND}}"

func NewConfig() IConfig {
return &Config{
falsePositiveHashes: []string{},
Expand Down Expand Up @@ -168,7 +170,7 @@ func (c *Config) GetDefaultConfigFilePath() string {
}

func (c *Config) GetVersion() string {
return "{{VERSION_NOT_FOUND}}"
return version
}

func (c *Config) GetConfigFilePath() string {
Expand Down
45 changes: 45 additions & 0 deletions goreleaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Copyright 2021 ZUP IT SERVICOS EM TECNOLOGIA E INOVACAO SA
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

project_name: horusec
builds:
- id: horusec
env: [ CGO_ENABLED=0 ]
main: ./cmd/app/main.go
ldflags:
- -X github.com/ZupIT/horusec/config.version=v{{ .Version }}
goos:
- linux
- windows
- darwin
goarch:
- amd64
- 386
changelog:
skip: true
archives:
- id: horusec
builds:
- horusec
name_template: "{{ .ProjectName }}_{{ .Os }}_{{ .Arch }}"
format: binary
replacements:
amd64: x64
386: x86
darwin: mac
windows: win
checksum:
name_template: 'checksums.txt'
release:
draft: true