Skip to content

Commit 25161d3

Browse files
committed
Add release workflow, goreleaser, go pkg layout
1 parent 5605a1e commit 25161d3

File tree

6 files changed

+104
-3
lines changed

6 files changed

+104
-3
lines changed

.github/workflows/release.yaml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- "v*"
7+
8+
env:
9+
GOVERSION: "1.18"
10+
11+
jobs:
12+
release:
13+
name: Release
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@v3
17+
with:
18+
fetch-depth: 0
19+
- uses: actions/setup-go@v3
20+
with:
21+
go-version: ${{ env.GOVERSION }}
22+
- uses: actions/cache@v3
23+
with:
24+
path: |
25+
~/go/pkg/mod
26+
~/.cache/go-build
27+
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
28+
restore-keys: ${{ runner.os }}-go-
29+
- uses: goreleaser/goreleaser-action@v2
30+
with:
31+
args: release
32+
env:
33+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.goreleaser.yaml

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
project_name: axiom-cloudfront-lambda
2+
3+
builds:
4+
- id: axiom-cloudfront-lambda
5+
goos:
6+
- linux
7+
goarch:
8+
- amd64
9+
binary: axiom-cloudfront-lambda
10+
main: ./cmd/axiom-cloudfront-lambda
11+
build:
12+
env:
13+
- CGO_ENABLED=0
14+
tags:
15+
- osusergo
16+
- netgo
17+
- static_build
18+
flags:
19+
- -buildvcs=false
20+
- -buildmode=pie
21+
- -installsuffix=cgo
22+
- -trimpath
23+
ldflags:
24+
- -s -w -extldflags "-fno-PIC -static -Wl -z now -z relro"
25+
- -X github.com/axiomhq/pkg/version.release={{ .Version }}
26+
- -X github.com/axiomhq/pkg/version.revision={{ .ShortCommit }}
27+
- -X github.com/axiomhq/pkg/version.buildDate={{ .CommitDate }}
28+
- -X github.com/axiomhq/pkg/version.buildUser=goreleaser
29+
mod_timestamp: "{{ .CommitTimestamp }}"
30+
31+
archives:
32+
- id: axiom-cloudfront-lambda
33+
builds:
34+
- axiom-cloudfront-lambda
35+
name_template: "{{ .ProjectName }}_{{ .Version }}"
36+
wrap_in_directory: true
37+
format: zip
38+
files:
39+
- LICENSE
40+
- README.md
41+
42+
checksum:
43+
name_template: checksums.txt
44+
45+
snapshot:
46+
name_template: "{{ .Tag }}-next"
47+
48+
changelog:
49+
sort: asc
50+
filters:
51+
exclude:
52+
- "^docs:"
53+
- "^test:"
54+
55+
milestones:
56+
- repo:
57+
owner: axiomhq
58+
name: axiom-cloudfront-lambda
59+
close: true
60+
fail_on_error: false
61+
62+
release:
63+
github:
64+
owner: axiomhq
65+
name: axiom-cloudfront-lambda
66+
prerelease: auto
67+
name_template: "Axiom CloudFront Lambda v{{ .Version }}"

main.go renamed to cmd/axiom-cloudfront-lambda/main.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,15 @@ import (
1313
"github.com/aws/aws-sdk-go/aws"
1414
"github.com/aws/aws-sdk-go/aws/session"
1515
"github.com/aws/aws-sdk-go/service/s3"
16-
"github.com/axiomhq/axiom-cloudfront-lambda/parser"
1716
"github.com/axiomhq/axiom-go/axiom"
1817
"github.com/axiomhq/pkg/cmd"
1918
"go.uber.org/zap"
19+
20+
"github.com/axiomhq/axiom-cloudfront-lambda/pkg/parser"
2021
)
2122

2223
func main() {
23-
cmd.Run("axiom-cloudwatch-lambda", run,
24+
cmd.Run("axiom-cloudfront-lambda", run,
2425
cmd.WithRequiredEnvVars("AXIOM_DATASET"),
2526
cmd.WithValidateAxiomCredentials(),
2627
)
File renamed without changes.

parser/parser_test.go renamed to pkg/parser/parser_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import (
1010

1111
func TestParseLogs(t *testing.T) {
1212
// read data from data/logs.tsv
13-
file, err := os.Open("../data/logs.tsv")
13+
file, err := os.Open("testdata/logs.tsv")
1414
require.NoError(t, err)
1515
defer file.Close()
1616

File renamed without changes.

0 commit comments

Comments
 (0)