Skip to content

Commit a157f73

Browse files
feat: initial
1 parent 5002cef commit a157f73

File tree

7 files changed

+123
-0
lines changed

7 files changed

+123
-0
lines changed

Diff for: .github/workflows/ci.yml

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: CI
2+
on:
3+
push:
4+
branches:
5+
- '**'
6+
pull_request:
7+
branches:
8+
- '**'
9+
jobs:
10+
lint:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v3
14+
- uses: actions/setup-go@v3
15+
with:
16+
go-version: 1.19
17+
- uses: golangci/golangci-lint-action@v3
18+
test:
19+
runs-on: ubuntu-latest
20+
needs: lint
21+
steps:
22+
- uses: actions/checkout@v3
23+
- uses: actions/setup-go@v3
24+
with:
25+
go-version: 1.19
26+
- run: go test -v ./...
27+
release:
28+
runs-on: ubuntu-latest
29+
needs: test
30+
permissions:
31+
contents: write
32+
steps:
33+
- uses: actions/checkout@v3
34+
- uses: actions/setup-go@v3
35+
with:
36+
go-version: 1.19
37+
- uses: go-semantic-release/action@v1
38+
with:
39+
hooks: goreleaser
40+
env:
41+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Diff for: .gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
.idea/
2+
example-go-application

Diff for: .goreleaser.yaml

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
builds:
2+
- env:
3+
- CGO_ENABLED=0
4+
targets:
5+
- linux_amd64
6+
- darwin_amd64
7+
- darwin_arm64
8+
main: ./cmd/semantic-release/
9+
flags:
10+
- -trimpath
11+
- -buildvcs=false
12+
ldflags:
13+
- -extldflags '-static'
14+
- -s -w
15+
- -X main.version={{.Version}}
16+
- -X main.commitSHA={{.FullCommit}}
17+
- -X main.commitDate={{.CommitDate}}

Diff for: LICENSE

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
Copyright (c) 2023 Christoph Witzko
2+
3+
Permission is hereby granted, free of charge, to any person obtaining a copy
4+
of this software and associated documentation files (the "Software"), to deal
5+
in the Software without restriction, including without limitation the rights
6+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7+
copies of the Software, and to permit persons to whom the Software is
8+
furnished to do so, subject to the following conditions:
9+
10+
The above copyright notice and this permission notice shall be included in all
11+
copies or substantial portions of the Software.
12+
13+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19+
SOFTWARE.

Diff for: README.md

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# example-go-application
2+
3+
This example repository shows how to use go-semantic-release to release a Go application with GitHub Actions.
4+
5+
Releases are created automatically when a commit is pushed to the main branch. All releases can be found on the [releases page](https://github.com/go-semantic-release/example-go-application/releases).
6+
7+
The binaries can be downloaded directly from the release page or via [get-release.xyz](https://get-release.xyz).
8+
```bash
9+
curl -SLO "https://get-release.xyz/go-semantic-release/example-go-application/$(go env GOOS)/$(go env GOARCH)"
10+
```

Diff for: go.mod

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
module example-go-application
2+
3+
go 1.19

Diff for: main.go

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
package main
2+
3+
import (
4+
"fmt"
5+
"runtime/debug"
6+
"strings"
7+
)
8+
9+
var (
10+
version = "dev"
11+
commitSHA = "none"
12+
commitDate = "unknown"
13+
)
14+
15+
func main() {
16+
fmt.Println(strings.Repeat("-", 30))
17+
fmt.Println("example-go-application")
18+
fmt.Println(strings.Repeat("-", 30))
19+
fmt.Printf("* version:\t%s\n", version)
20+
fmt.Printf("* commit:\t%s\n", commitSHA)
21+
fmt.Printf("* build date:\t%s\n", commitDate)
22+
buildInfo, ok := debug.ReadBuildInfo()
23+
if !ok {
24+
return
25+
}
26+
fmt.Println(strings.Repeat("-", 30))
27+
for _, setting := range buildInfo.Settings {
28+
fmt.Printf("%s\t= %s\n", setting.Key, setting.Value)
29+
}
30+
fmt.Println(strings.Repeat("-", 30))
31+
}

0 commit comments

Comments
 (0)