Skip to content

Commit 1355dcd

Browse files
committed
first
Signed-off-by: Carlos Alexandro Becker <[email protected]>
0 parents  commit 1355dcd

File tree

5 files changed

+68
-0
lines changed

5 files changed

+68
-0
lines changed

.github/workflows/release.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: goreleaser
2+
3+
on:
4+
push:
5+
tags:
6+
- "*"
7+
8+
permissions:
9+
contents: write
10+
11+
jobs:
12+
goreleaser:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Checkout
16+
uses: actions/checkout@v4
17+
with:
18+
fetch-depth: 0
19+
- name: Set up Go
20+
uses: actions/setup-go@v5
21+
- name: Run GoReleaser
22+
uses: goreleaser/goreleaser-action@v6
23+
with:
24+
distribution: goreleaser
25+
version: "~> v2"
26+
args: release --clean
27+
env:
28+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
dist/

.goreleaser.yaml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
version: 2
2+
3+
project_name: my-cli
4+
5+
builds:
6+
- binary: my-cli
7+
ldflags:
8+
# I put a fixed value to check if the problem was in the {{.Version}} variable or not
9+
# Even using a fixed value the version is not setted in main.Version variable
10+
- -s -w -X main.Version={{.Version}}
11+
env:
12+
- CGO_ENABLED=0
13+
goos:
14+
- linux
15+
- darwin
16+
goarch:
17+
- amd64
18+
- arm64
19+
20+
archives:
21+
- formats: [tar.gz]
22+
name_template: >-
23+
{{ .ProjectName }}_
24+
{{- title .Os }}_
25+
{{- if eq .Arch "amd64" }}x86_64
26+
{{- else if eq .Arch "386" }}i386
27+
{{- else }}{{ .Arch }}{{ end }}

go.mod

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
module issue396
2+
3+
go 1.22.12

main.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
package main
2+
3+
import "fmt"
4+
5+
var Version = "dev"
6+
7+
func main() {
8+
fmt.Printf("version: %s 👍\n", Version)
9+
}

0 commit comments

Comments
 (0)