diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml new file mode 100644 index 0000000..4482f84 --- /dev/null +++ b/.github/workflows/docker.yml @@ -0,0 +1,25 @@ +name: "docker" +on: + push: + branches: + - master + pull_request: + types: [opened, synchronize, reopened] + release: + types: + - created +jobs: + build-and-push: + runs-on: ubuntu-latest + steps: + - name: "Checkout source code at current commit" + uses: actions/checkout@v2 + - name: "Build and push docker image to DockerHub" + uses: docker/build-push-action@v1 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_PASSWORD }} + repository: ${{ github.repository }} + registry: registry-1.docker.io + tag_with_ref: true + tag_with_sha: true diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml new file mode 100644 index 0000000..22713b9 --- /dev/null +++ b/.github/workflows/go.yml @@ -0,0 +1,52 @@ +name: 'go' + +on: + release: + types: [published] + + pull_request: + types: [opened, synchronize, reopened] + +jobs: + build: + runs-on: ubuntu-latest + steps: + # Checkout the repo + - name: 'Checkout' + uses: actions/checkout@v2 + # Build Go binaries + - name: 'Build Go binaries' + uses: cloudposse/actions/go/build@0.15.0 + env: + GO111MODULE: on + # Architectures to build for + GOX_OSARCH: >- + windows/386 + windows/amd64 + freebsd/arm + netbsd/386 + netbsd/amd64 + netbsd/arm + linux/s390x + linux/arm + darwin/386 + darwin/amd64 + linux/386 + linux/amd64 + freebsd/amd64 + freebsd/386 + openbsd/386 + openbsd/amd64 + OUTPUT_PATH: ${{ github.workspace }}/release/${{ github.event.repository.name }}_ + - name: 'Upload artifacts' + uses: actions/upload-artifact@v2 + with: + name: ${{ github.event.repository.name }} + path: ${{ github.workspace }}/release/* + # Attach Go binaries to GitHub Release + - name: 'Attach artifacts to GitHub Release' + if: ${{ github.event_name == 'release' }} + uses: cloudposse/actions/github/release-assets@0.15.0 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + INPUT_PATH: ${{ github.workspace }}/release/${{ github.event.repository.name }}_* diff --git a/Dockerfile b/Dockerfile index 571740f..daf4834 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,12 +1,12 @@ -FROM golang:1.11.2 as builder -RUN mkdir -p /go/src/github.com/cloudposse/github-status-updater -WORKDIR /go/src/github.com/cloudposse/github-status-updater -COPY . . -RUN go get && CGO_ENABLED=0 go build -v -o "./dist/bin/github-status-updater" *.go +FROM golang:1.13.3-buster as builder +ENV GO111MODULE=on +ENV CGO_ENABLED=0 +WORKDIR /usr/src/ +COPY . /usr/src +RUN go build -v -o "bin/github-status-updater" *.go - -FROM alpine:3.8 +FROM alpine:3.12 RUN apk add --no-cache ca-certificates -COPY --from=builder /go/src/github.com/cloudposse/github-status-updater/dist/bin/github-status-updater /usr/bin/github-status-updater +COPY --from=builder /usr/src/bin/* /usr/bin/ ENV PATH $PATH:/usr/bin ENTRYPOINT ["github-status-updater"] diff --git a/README.md b/README.md index bf78ab9..4edfcbd 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# github-status-updater [![Build Status](https://travis-ci.org/cloudposse/github-status-updater.svg?branch=master)](https://travis-ci.org/cloudposse/github-status-updater) +# github-status-updater ![docker](https://github.com/cloudposse/github-status-updater/workflows/docker/badge.svg?branch=master) ![go](https://github.com/cloudposse/github-status-updater/workflows/go/badge.svg?branch=master) Command line utility for updating GitHub commit statuses and enabling required status checks for pull requests. diff --git a/glide.yaml b/glide.yaml deleted file mode 100644 index 5531b62..0000000 --- a/glide.yaml +++ /dev/null @@ -1,4 +0,0 @@ -package: github.com/cloudposse/github-status-updater -import: - - package: github.com/google/go-github/github - - package: golang.org/x/net/context diff --git a/go.mod b/go.mod new file mode 100644 index 0000000..10d1aff --- /dev/null +++ b/go.mod @@ -0,0 +1,9 @@ +module github.com/cloudposse/github-status-updater + +go 1.13 + +require ( + github.com/google/go-github v17.0.0+incompatible + github.com/google/go-querystring v1.0.0 // indirect + golang.org/x/net v0.0.0-20200625001655-4c5254603344 +) diff --git a/go.sum b/go.sum new file mode 100644 index 0000000..b9704ae --- /dev/null +++ b/go.sum @@ -0,0 +1,13 @@ +github.com/google/go-github v17.0.0+incompatible h1:N0LgJ1j65A7kfXrZnUDaYCs/Sf4rEjNlfyDHW9dolSY= +github.com/google/go-github v17.0.0+incompatible/go.mod h1:zLgOLi98H3fifZn+44m+umXrS52loVEgC2AApnigrVQ= +github.com/google/go-querystring v1.0.0 h1:Xkwi/a1rcvNg1PPYe5vI8GbeBY/jrVuDX5ASuANWTrk= +github.com/google/go-querystring v1.0.0/go.mod h1:odCYkC5MyYFN7vkCjXpyrEuKhc/BUO6wN/zVPAxq5ck= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20200625001655-4c5254603344 h1:vGXIOMxbNfDTk/aXCmfdLgkrSV+Z2tcbze+pEc3v5W4= +golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=