-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: integrate GoReleaser for releasing binaries (#6)
* chore: add release workflow with GoReleaser tool * Fix linting issues * Activate release workflow on push in main branch * Disable releasing from old GH actions workflow
- Loading branch information
1 parent
1bbbe99
commit e0dd7c7
Showing
24 changed files
with
285 additions
and
113 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
name: Release | ||
on: | ||
push: | ||
branches: | ||
- 'main' | ||
|
||
jobs: | ||
release: | ||
name: goreleaser | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
|
||
- name: Unshallow | ||
run: git fetch --prune --unshallow | ||
|
||
# this step can be removed if setup-go will support reading go-version from go.mod | ||
- name: Determine Go version | ||
run: | | ||
sed -En 's/^go[[:space:]]+([[:digit:].]+)$/GO_VERSION=\1/p' go.mod >> $GITHUB_ENV | ||
- name: Set up Go | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: ${{ env.GO_VERSION }} | ||
|
||
- name: Set up Snyk CLI | ||
uses: snyk/actions/setup@master | ||
|
||
- name: Cache Go modules | ||
uses: actions/cache@v2 | ||
with: | ||
path: | | ||
~/.cache/go-build | ||
~/go/pkg/mod | ||
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | ||
restore-keys: ${{ runner.os }}-go- | ||
|
||
- name: Lint source code | ||
run: | | ||
make tools lint | ||
- name: Run tests | ||
env: | ||
DEEPROXY_API_URL: ${{secrets.DEEPROXY_API_URL}} | ||
SNYK_TOKEN: ${{secrets.SNYK_TOKEN }} | ||
run: | | ||
make clean test | ||
- name: Set up Git actions user | ||
uses: fregante/setup-git-user@v1 | ||
|
||
- name: Create release tag | ||
run: | | ||
git tag "v$(date +'%Y%m%d.%H%M%S')" | ||
git push --tags | ||
sudo mv snyk-linux* /usr/local/bin/ | ||
- name: Release binaries with GoReleaser | ||
uses: goreleaser/goreleaser-action@v2 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
args: release --rm-dist |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
project_name: "snyk-lsp" | ||
|
||
archives: | ||
- format: zip | ||
name_template: "{{ .ProjectName }}_{{ .Version}}_{{ .Os }}_{{ .Arch }}" | ||
|
||
before: | ||
hooks: | ||
- go mod tidy | ||
|
||
builds: | ||
- flags: | ||
- -trimpath | ||
goarch: | ||
- "386" | ||
- amd64 | ||
- arm64 | ||
goos: | ||
- darwin | ||
- linux | ||
- windows | ||
ignore: | ||
- goarch: "386" | ||
goos: darwin | ||
- goarch: arm64 | ||
goos: windows | ||
ldflags: | ||
- -s -w -X main.gitinfo={{.Version}} | ||
mod_timestamp: "{{ .CommitTimestamp }}" | ||
hooks: | ||
post: | ||
- upx -9fv --lzma "{{ .Path }}" | ||
|
||
checksum: | ||
name_template: "{{ .ProjectName }}_{{ .Version }}_SHA256SUMS" | ||
algorithm: sha256 | ||
|
||
dist: build | ||
|
||
env: | ||
- GO111MODULE=on | ||
- CGO_ENABLED=0 |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.