Skip to content

Commit 59561aa

Browse files
zdmytrivYour Name
andauthored
Releasing with goreleaser (#21)
* Releasing with goreleaser * Releasing with goreleaser * Releasing with goreleaser * addressed comments and removed sources from being attached to release via goreleaser because they are attached anyway so no need to do it twice * Addressed comments * splitted build.yml workflow into and build.yml and build-snapshot.yml * update --------- Co-authored-by: Your Name <you@example.com>
1 parent 0777ec9 commit 59561aa

File tree

8 files changed

+118
-79
lines changed

8 files changed

+118
-79
lines changed

.github/workflows/feature-branch.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Feature Branch
2+
3+
on:
4+
workflow_dispatch:
5+
6+
pull_request:
7+
types:
8+
- opened
9+
- synchronize
10+
- reopened
11+
12+
jobs:
13+
build:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: Checkout
17+
uses: actions/checkout@v3
18+
with:
19+
fetch-depth: 0
20+
21+
- name: Set up Go
22+
uses: actions/setup-go@v3
23+
with:
24+
go-version: '1.20'
25+
26+
- name: Test Snapshot Release
27+
uses: goreleaser/goreleaser-action@v4
28+
with:
29+
distribution: goreleaser
30+
version: latest
31+
args: release --clean --snapshot
32+
33+
- name: Upload Test Release Assets
34+
uses: actions/upload-artifact@v3
35+
with:
36+
name: github-status-updater
37+
path: dist/*
38+
retention-days: 3

.github/workflows/go.yml

Lines changed: 0 additions & 52 deletions
This file was deleted.

.github/workflows/release.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: Release
2+
3+
on:
4+
workflow_dispatch:
5+
6+
release:
7+
types:
8+
- published
9+
10+
permissions:
11+
contents: write
12+
13+
jobs:
14+
build:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- name: Checkout
18+
uses: actions/checkout@v3
19+
with:
20+
fetch-depth: 0
21+
22+
- name: Set up Go
23+
uses: actions/setup-go@v3
24+
with:
25+
go-version: '1.20'
26+
27+
- name: Public Release
28+
uses: goreleaser/goreleaser-action@v4
29+
with:
30+
distribution: goreleaser
31+
version: latest
32+
args: release --clean
33+
env:
34+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.gitignore

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,4 @@ build-harness
1717
# Output of the go coverage tool, specifically when used with LiteIDE
1818
*.out
1919

20-
# Project-local glide cache, RE: https://github.com/Masterminds/glide/issues/736
21-
.glide/
20+
dist/

.goreleaser.yaml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
builds:
2+
- env:
3+
# goreleaser does not work with CGO, it could also complicate
4+
# usage by users in CI/CD systems like Terraform Cloud where
5+
# they are unable to install libraries.
6+
- CGO_ENABLED=0
7+
mod_timestamp: '{{ .CommitTimestamp }}'
8+
goos:
9+
- darwin
10+
- freebsd
11+
- windows
12+
- linux
13+
goarch:
14+
- amd64
15+
- '386'
16+
- arm
17+
- arm64
18+
ldflags:
19+
# -s Omit the symbol table and debug information
20+
# -w Omit the DWARF symbol table
21+
# -X importpath.name=value # set the value of the string variable in importpath named name to value
22+
# Someday we could implement a "version" command and set the version like this:
23+
# - '-s -w -X "github.com/cloudposse/github-status-updater/cmd.Version={{.Env.GORELEASER_CURRENT_TAG}}"'
24+
- '-s -w'
25+
26+
archives:
27+
- format: binary
28+
name_template: '{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}'
29+
30+
checksum:
31+
name_template: '{{ .ProjectName }}_{{ .Version }}_SHA256SUMS'
32+
algorithm: sha256
33+
34+
release:
35+
# If you want to manually examine the release before it is live, uncomment this line:
36+
# draft: true
37+
38+
changelog:
39+
skip: true

Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
FROM golang:1.13.3-buster as builder
1+
FROM golang:1.20.3-bullseye as builder
22
ENV GO111MODULE=on
33
ENV CGO_ENABLED=0
44
WORKDIR /usr/src/
55
COPY . /usr/src
66
RUN go build -v -o "bin/github-status-updater" *.go
77

8-
FROM alpine:3.12
8+
FROM alpine:3.17
99
RUN apk add --no-cache ca-certificates
1010
COPY --from=builder /usr/src/bin/* /usr/bin/
1111
ENV PATH $PATH:/usr/bin

go.mod

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
module github.com/cloudposse/github-status-updater
22

3-
go 1.17
3+
go 1.20
44

55
require github.com/google/go-github/v42 v42.0.0
66

77
require (
88
github.com/google/go-querystring v1.1.0 // indirect
9-
golang.org/x/crypto v0.0.0-20210817164053-32db794688a5 // indirect
9+
golang.org/x/crypto v0.8.0 // indirect
1010
)

go.sum

Lines changed: 2 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,9 @@
1-
github.com/bradleyfalzon/ghinstallation/v2 v2.0.3/go.mod h1:tlgi+JWCXnKFx/Y4WtnDbZEINo31N5bcvnCoqieefmk=
2-
github.com/golang-jwt/jwt/v4 v4.0.0/go.mod h1:/xlHOz8bRuivTWchD4jCa+NbatV+wEUSzwAxVc6locg=
3-
github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
4-
github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
51
github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
62
github.com/google/go-cmp v0.5.6 h1:BKbKCqvP6I+rmFHt06ZmyQtvB8xAkWdhFyr0ZUNZcxQ=
7-
github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
8-
github.com/google/go-github/v39 v39.0.0/go.mod h1:C1s8C5aCC9L+JXIYpJM5GYytdX52vC1bLvHEF1IhBrE=
93
github.com/google/go-github/v42 v42.0.0 h1:YNT0FwjPrEysRkLIiKuEfSvBPCGKphW5aS5PxwaoLec=
104
github.com/google/go-github/v42 v42.0.0/go.mod h1:jgg/jvyI0YlDOM1/ps6XYh04HNQ3vKf0CVko62/EhRg=
115
github.com/google/go-querystring v1.1.0 h1:AnCroh3fv4ZBgVIf1Iwtovgjaw/GiKJo8M8yD/fhyJ8=
126
github.com/google/go-querystring v1.1.0/go.mod h1:Kcdr2DB4koayq7X8pmAG4sNG59So17icRSOU623lUBU=
13-
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
14-
golang.org/x/crypto v0.0.0-20210817164053-32db794688a5 h1:HWj/xjIHfjYU5nVXpTM0s39J9CbLn7Cc5a7IC5rwsMQ=
15-
golang.org/x/crypto v0.0.0-20210817164053-32db794688a5/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
16-
golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks=
17-
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
18-
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
19-
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
20-
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
21-
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
22-
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
23-
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
24-
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
25-
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
26-
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
7+
golang.org/x/crypto v0.8.0 h1:pd9TJtTueMTVQXzk8E2XESSMQDj/U7OUu0PqJqPXQjQ=
8+
golang.org/x/crypto v0.8.0/go.mod h1:mRqEX+O9/h5TFCrQhkgjo2yKi0yYA+9ecGkdQoHrywE=
279
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
28-
google.golang.org/appengine v1.6.7/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc=

0 commit comments

Comments
 (0)