Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,16 +59,22 @@
- name: "Git Version"
id: generate-version
uses: codacy/[email protected]
with:
release-branch: main
prefix: v
- name: "Tag version"
run: |
git tag ${{ steps.generate-version.outputs.version }}
git push --tags "https://codacy:${{ secrets.GITHUB_TOKEN }}@github.com/codacy/codacy-cli-v2"
- name: Get Go version
id: go-version

Check warning on line 70 in .github/workflows/go.yml

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

.github/workflows/go.yml#L70

An action sourced from a third-party repository on GitHub is not pinned to a full length commit SHA. Pinning an action to a full length commit SHA is currently the only way to use an action as an immutable release.
run: echo "VERSION=$(go version | cut -d' ' -f3)" >> $GITHUB_OUTPUT
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v5
with:
distribution: goreleaser
# 'latest', 'nightly', or a semver
version: "latest"
version: "~> v1"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

his change to version: "~> v1" means:
You'll always get the latest v1.x.x release
You're protected from breaking changes that might come in v2.0.0
You'll automatically get bug fixes and minor improvements within the v1 series
It's more flexible than pinning to a specific version while still maintaining stability
This is what the warning was suggesting as a best practice, and it's a better approach than either using latest (too loose) or a specific version like v1.21.1 (too strict).

args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GOVERSION: ${{ steps.go-version.outputs.VERSION }}
51 changes: 51 additions & 0 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
project_name: codacy-cli-v2

before:
hooks:
- go mod tidy

builds:
- env:
- CGO_ENABLED=0
goos:
- linux
- windows
- darwin
goarch:
- amd64
- arm64
ldflags:
- -s -w
- -X codacy/cli-v2/version.Version={{.Version}}
- -X codacy/cli-v2/version.GitCommit={{.ShortCommit}}
- -X codacy/cli-v2/version.BuildTime={{.Date}}
- -X codacy/cli-v2/version.Os={{.Os}}
- -X codacy/cli-v2/version.Arch={{.Arch}}
- -X codacy/cli-v2/version.GoVersion={{.Env.GOVERSION}}
binary: cli-v2

archives:
- format: tar.gz
name_template: >-
{{ .ProjectName }}_
{{- .Version }}_
{{- .Os }}_
{{- .Arch }}
format_overrides:
- goos: windows
format: zip

changelog:
sort: asc
filters:
exclude:
- '^docs:'
- '^test:'
- '^ci:'
- Merge pull request
- Merge branch

release:
github:
owner: codacy
name: codacy-cli-v2
Loading