upsidr / merge-gatekeeper

Get better merge control
MIT License
85 stars 14 forks source link

feat: Move main.go into root for direct install. #68

Closed mdjward closed 1 year ago

mdjward commented 1 year ago

Motivation

TL;DR: make it easier to run go install github.com/upsidr/merge-gatekeeper@v${GATEKEEPER_VERSION}

Docker Hub rate limiting makes repeatedly pulling the Golang image to build this action from GitHub actions problematic.

In my use case, a private registry and cache for the action runners is already available, to which I'm storing the amd64 build of the following:

# syntax=docker/dockerfile:1

FROM golang:1.16-alpine AS go

ARG GATEKEEPER_VERSION="1.2.1"

RUN apk add --no-cache git \
    && go get github.com/upsidr/merge-gatekeeper@v${GATEKEEPER_VERSION} \
    && cd ${GOPATH}/pkg/mod/github.com/upsidr/merge-gatekeeper@v${GATEKEEPER_VERSION} \
    && GO111MODULE=on LANG=en_US.UTF-8 CGO_ENABLED=0 go build ./cmd/merge-gatekeeper \
    && mv merge-gatekeeper /go/bin

FROM alpine:3.17 AS alpine

COPY --from=go /go/bin/merge-gatekeeper /usr/local/bin/merge-gatekeeper

ENTRYPOINT ["/usr/local/bin/merge-gatekeeper"]

Using go install would simplify this a lot.

Changes

  1. Moved main.go and version.txt into the repository root.
  2. Updated version.txt to the latest tagged version of your repo.

Side note: propose leveraging Actions and a Semantic release tool (example) to automate version changes.

I'm keen to contribute other changes in line with my use-case, but this one is pretty fundamental to my use case. Thanks in advance!

rytswd commented 1 year ago

Side note: propose leveraging Actions and a Semantic release tool (example) to automate version changes.

Thanks for the note, and we understand that the current setup is quite manual and error prone. We are absolutely open to ideas!

In the meantime, I'm getting this change merged 🥰