Skip to content

Commit

Permalink
Pull in workflows from gcredstash
Browse files Browse the repository at this point in the history
  • Loading branch information
kgaughan committed Jul 26, 2024
1 parent 2601f8a commit bec4f2b
Show file tree
Hide file tree
Showing 6 changed files with 60 additions and 50 deletions.
20 changes: 13 additions & 7 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,22 @@ on:
- push
- pull_request

permissions:
contents: read
pull-requests: read

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: 1.13
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod
check-latest: true
cache: true

- name: Build
run: make
- name: Build
run: make
24 changes: 17 additions & 7 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,25 @@ on:
- push
- pull_request

permissions:
contents: read
pull-requests: read

jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- uses: actions/setup-go@v5
with:
go-version-file: go.mod
check-latest: true
cache: true

- name: Lint
uses: golangci/golangci-lint-action@v3
with:
version: v1.59.1
args: --issues-exit-code=0
only-new-issues: true
- name: Lint
uses: golangci/golangci-lint-action@v6
with:
version: v1.59.1
args: --issues-exit-code=0
only-new-issues: true
41 changes: 15 additions & 26 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,33 +20,19 @@ jobs:

permissions:
contents: write
packages: write

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up Go
uses: actions/setup-go@v4

- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v4
uses: actions/setup-go@v5
with:
distribution: goreleaser
version: latest
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

build-and-push-image:
runs-on: ubuntu-latest

permissions:
contents: read
packages: write

steps:
- uses: actions/checkout@v3
go-version-file: go.mod
check-latest: true
cache: true

- name: Log in to the Container registry
uses: docker/login-action@v2
Expand All @@ -61,10 +47,13 @@ jobs:
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}

- name: Build and push Docker image
uses: docker/build-push-action@v4
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v6
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
distribution: goreleaser
version: "~> v2"
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
REGISTRY: ${{ env.REGISTRY }}
IMAGE: ${{ env.IMAGE_NAME }}
14 changes: 13 additions & 1 deletion .goreleaser.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
---
version: 2

before:
hooks:
- go mod tidy
- go mod download

builds:
- env:
Expand All @@ -18,6 +21,7 @@ builds:
- -trimpath
ldflags:
- -s -w -X main.Version={{.Version}}
mod_timestamp: "{{ .CommitTimestamp }}"
tags:
- netgo

Expand All @@ -40,8 +44,16 @@ archives:
- LICENSE
- README.md

dockers:
- image_templates:
- "{{ .Env.REGISTRY }}/{{ .Env.IMAGE }}:{{ .Tag }}"
skip_push: auto
use: buildx
dockerfile: Dockerfile

checksum:
name_template: "checksums.txt"
algorithm: sha256
name_template: '{{ .ProjectName }}_{{ .Version }}_SHA256SUMS'

snapshot:
name_template: "{{ incpatch .Version }}-next"
Expand Down
9 changes: 1 addition & 8 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,4 @@
FROM golang:1.18 AS builder

ENV GOPATH /go
ENV APPPATH /repo
COPY . /repo
RUN cd /repo && CGO_ENABLED=0 go build -tags netgo -trimpath -ldflags '-s -w'

FROM alpine:latest
COPY --from=builder /repo/nxtp /nxtp
COPY nxtp .
EXPOSE 12300
ENTRYPOINT ["/nxtp", "-endpoint", ":12300"]
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module nxtp
module github.com/kgaughan/nxtp

go 1.13

0 comments on commit bec4f2b

Please sign in to comment.