Skip to content

Commit

Permalink
Add project commands
Browse files Browse the repository at this point in the history
  • Loading branch information
janos committed Jan 4, 2020
1 parent 71fbe4e commit 13ceb16
Show file tree
Hide file tree
Showing 29 changed files with 2,161 additions and 72 deletions.
86 changes: 43 additions & 43 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,46 +11,46 @@ jobs:

steps:

- name: Set up Go
uses: actions/setup-go@v1
with:
go-version: 1.x

- name: Set up env
run: |
echo "::set-env name=GOPATH::$(go env GOPATH)"
echo "::add-path::$(go env GOPATH)/bin"
shell: bash

- name: Checkout
uses: actions/checkout@v1
with:
fetch-depth: 1

- name: Cache Go modules
uses: actions/cache@v1
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-build-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.OS }}-build-${{ env.cache-name }}-
${{ runner.OS }}-build-
${{ runner.OS }}-
- name: Set up GolangCI-Lint
run: go get -u github.com/golangci/golangci-lint/cmd/golangci-lint
working-directory: ~

- name: GolangCI-Lint
run: golangci-lint run

- name: Vet
run: go vet -v ./...

- name: Build
env:
CGO_ENABLED: 0
run: go build -ldflags "-s -w" ./...

- name: Test
run: go test -v -race ./...
- name: Set up Go
uses: actions/setup-go@v1
with:
go-version: 1.x

- name: Set up env
run: |
echo "::set-env name=GOPATH::$(go env GOPATH)"
echo "::add-path::$(go env GOPATH)/bin"
shell: bash

- name: Checkout
uses: actions/checkout@v1
with:
fetch-depth: 1

- name: Cache Go modules
uses: actions/cache@v1
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-build-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.OS }}-build-${{ env.cache-name }}-
${{ runner.OS }}-build-
${{ runner.OS }}-
- name: Set up GolangCI-Lint
run: go get -u github.com/golangci/golangci-lint/cmd/golangci-lint
working-directory: ~

- name: GolangCI-Lint
run: golangci-lint run

- name: Vet
run: go vet -v ./...

- name: Build
env:
CGO_ENABLED: 0
run: go build -ldflags "-s -w" ./...

- name: Test
run: go test -v -race ./...
30 changes: 30 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Release

on:
push:
branches-ignore:
- '**'
tags:
- 'v*.*.*'

jobs:
goreleaser:
runs-on: ubuntu-latest
steps:

- name: Checkout
uses: actions/checkout@v1

- name: Set up Go
uses: actions/setup-go@v1
with:
go-version: 1.x

- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v1
with:
version: latest
args: release --rm-dist
key: ${{ secrets.YOUR_PRIVATE_KEY }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
30 changes: 30 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/dist
/.idea
/.vscode

# Compiled Object files, Static and Dynamic libs (Shared Objects)
*.o
*.a
*.so

# Folders
_obj
_test

# Architecture specific extensions/prefixes
*.[568vq]
[568vq].out

*.cgo1.go
*.cgo2.c
_cgo_defun.c
_cgo_gotypes.go
_cgo_export.*

_testmain.go

*.exe
*.test
*.prof

.DS_Store
62 changes: 62 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
project_name: newreleases

builds:
- main: ./newreleases/main.go

binary: newreleases

flags:
- -v
- -trimpath

ldflags:
- -s -w

env:
- CGO_ENABLED=0

goos:
- darwin
- linux
- windows

goarch:
- amd64
- 386
- arm64
- arm

ignore:
- goos: darwin
goarch: 386
- goos: darwin
goarch: arm64
- goos: darwin
goarch: arm
- goos: windows
goarch: arm64
- goos: windows
goarch: arm

archives:
- name_template: "{{ tolower .ProjectName }}-{{ tolower .Os }}-{{ tolower .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}"

format: binary

nfpms:
- file_name_template: "{{ tolower .ProjectName }}-{{ tolower .Os }}-{{ tolower .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}"

vendor: NewReleases
homepage: https://newreleases.io/

maintainer: Janoš Guljaš <[email protected]>

description: NewReleases command line client.

license: BSD

formats:
- deb
- rpm

bindir: /usr/bin
Loading

0 comments on commit 13ceb16

Please sign in to comment.