-
Notifications
You must be signed in to change notification settings - Fork 465
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Setting up goreleaser to handle releases
To date releases have been a sort of manual process. The docker image was pushed on tagged releases, but then I needed to create the release in GH, copy all of the entries from CHANGELOG.md to it and finally build the binaries and attach them to the release. [GoReleaser](https://goreleaser.com/) can take care of all of that. When a tag is created, it will push the docker images and create the GitHub release with all of the CHANGELOG details (from the commits) as well as all of the binaries for supported OSs and archs. Brilliant! I also cleaned up the Makefile a bit to make things easier and avoid the need for installing binaries into system folders. With the exception of docker and unzip, everything else will be installed in `./bin` locally as needed. See `make help` for all the options.
- Loading branch information
1 parent
2dde019
commit 84fae50
Showing
15 changed files
with
210 additions
and
177 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,4 +4,3 @@ dist/ | |
examples/ | ||
fixtures/ | ||
tmp/ | ||
!/script |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
name: Release | ||
|
||
on: | ||
push: | ||
tags: | ||
- '*' | ||
|
||
jobs: | ||
release: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Login to Docker Hub | ||
uses: docker/login-action@v1 | ||
with: | ||
username: pseudomuto | ||
password: ${{ secrets.DOCKER_TOKEN }} | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 | ||
- name: Setup Go | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: 1.17 | ||
- name: Release | ||
uses: goreleaser/goreleaser-action@v2 | ||
with: | ||
version: latest | ||
args: release --rm-dist | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GH_RELEASE_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,4 @@ | ||
/_tools | ||
/bin | ||
/coverage.txt | ||
/dist | ||
/gen_fixtures | ||
/protoc-gen-doc | ||
/test/*.dat | ||
/vendor | ||
/tmp/ |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
project_name: protoc-gen-doc | ||
|
||
before: | ||
hooks: | ||
- go mod tidy | ||
|
||
builds: | ||
- main: ./cmd/protoc-gen-doc | ||
env: | ||
- CGO_ENABLED=0 | ||
goos: | ||
- darwin | ||
- linux | ||
- windows | ||
goarch: | ||
- amd64 | ||
- arm64 | ||
|
||
dockers: | ||
- image_templates: | ||
- pseudomuto/{{.ProjectName}}:latest | ||
- pseudomuto/{{.ProjectName}}:{{.Version}} | ||
- pseudomuto/{{.ProjectName}}:{{.Major}} | ||
- pseudomuto/{{.ProjectName}}:{{.Major}}.{{.Minor}} | ||
build_flag_templates: | ||
- "--pull" | ||
- "--label=org.opencontainers.image.created={{.Date}}" | ||
- "--label=org.opencontainers.image.title={{.ProjectName}}" | ||
- "--label=org.opencontainers.image.revision={{.FullCommit}}" | ||
- "--label=org.opencontainers.image.version={{.Version}}" | ||
- "--platform=linux/amd64" | ||
extra_files: | ||
- LICENSE.md | ||
- README.md | ||
- script/entrypoint.sh | ||
|
||
checksum: | ||
name_template: 'checksums.txt' | ||
|
||
snapshot: | ||
name_template: "{{ incpatch .Version }}-next" | ||
|
||
changelog: | ||
sort: asc | ||
filters: | ||
exclude: | ||
- '^docs:' | ||
- '^test:' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,13 @@ | ||
FROM golang:1.17-alpine AS builder | ||
WORKDIR /build | ||
COPY go.mod go.sum ./ | ||
RUN go mod download | ||
COPY . ./ | ||
RUN CGO_ENABLED=0 go build -ldflags="-s -w" -o protoc-gen-doc ./cmd/protoc-gen-doc | ||
|
||
FROM debian:bookworm-slim AS final | ||
LABEL maintainer="pseudomuto <david.muto@gmail.com>" protoc_version="3.18.1" | ||
|
||
FROM alpine:3.15.0 | ||
WORKDIR / | ||
|
||
ADD https://github.com/google/protobuf/releases/download/v3.18.1/protoc-3.18.1-linux-x86_64.zip ./ | ||
RUN apt-get -q -y update && \ | ||
apt-get -q -y install unzip && \ | ||
unzip protoc-3.18.1-linux-x86_64.zip -d ./usr/local && \ | ||
rm protoc-3.18.1-linux-x86_64.zip && \ | ||
apt-get remove --purge -y unzip && \ | ||
apt-get autoremove && \ | ||
rm -rf /var/lib/apt/lists/* | ||
RUN apk --update add bash protoc protobuf-dev && rm -rf /var/cache/apk/* | ||
|
||
COPY --from=builder /build/protoc-gen-doc /usr/local/bin | ||
COPY script/entrypoint.sh ./ | ||
COPY LICENSE.md README.md script/entrypoint.sh ./ | ||
COPY protoc-gen-doc /usr/bin/ | ||
|
||
VOLUME ["/out", "/protos"] | ||
VOLUME ["/out"] | ||
VOLUME ["/protos"] | ||
|
||
ENTRYPOINT ["/entrypoint.sh"] | ||
ENTRYPOINT ["./entrypoint.sh"] | ||
CMD ["--doc_opt=html,index.html"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.