Skip to content

Commit

Permalink
chore: update release process and to golang117 (#13)
Browse files Browse the repository at this point in the history
* chore(ci): switch to GH actions and goreleaser
* chore: bump to Golang 1.17
* chore(ci): switch to matrix build for testing
  • Loading branch information
mavogel authored Oct 20, 2021
1 parent a298d41 commit 179e9b0
Show file tree
Hide file tree
Showing 153 changed files with 811 additions and 28,335 deletions.
28 changes: 28 additions & 0 deletions .github/ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<!-- Please replace {Please write here} with your description -->


## Expected Behavior

{Please write here}


## Actual Behavior

{Please write here}


## Steps to Reproduce (including precondition)

{Please write here}


## Screenshot on This Problem (if possible)

{Please write here}


## Your Environment

- OS: {Please write here}
- binary version: {Please write here}

35 changes: 35 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<!-- Thank you for your contribution to envplate! Please replace {Please write here} with your description -->


## What does this do / why do we need it?

{Please write here}


## How this PR fixes the problem?

{Please write here}


## What should your reviewer look out for in this PR?

{Please write here}


## Check lists

* [ ] Test passed
* [ ] Coding style (indentation, etc)


## Additional Comments (if any)

{Please write here}


## Which issue(s) does this PR fix?

<!--
fixes #
fixes #
-->
30 changes: 30 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: build

on:
push:
branches:
- master
pull_request:
types: ['opened', 'synchronize']
paths:
- '**.go'
- go.mod
- '.github/workflows/**'

jobs:
binaries:
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.17
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v2
with:
version: latest
args: release --rm-dist --skip-publish --snapshot --skip-sign --debug
27 changes: 27 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: goreleaser

on:
push:
tags:
- '*'

jobs:
goreleaser:
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.17
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v2
with:
version: latest
args: release --rm-dist
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GORELEASER_TOKEN: ${{ secrets.GORELEASER_TOKEN }}
31 changes: 31 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: tests

on:
push:
branches:
- master
paths-ignore:
- 'README.md'
pull_request:
types: ['opened', 'synchronize']
paths-ignore:
- 'README.md'
jobs:
unit:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.17
- name: Run tests
run: go test -v -race -cover

2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,5 @@ build/
example/test.envs
keys/secret
manifest
.vscode
dist
39 changes: 39 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
before:
hooks:
- go mod tidy
builds:
- env:
- CGO_ENABLED=0
goos:
- darwin
- linux
goarch:
- arm64
- amd64
- "386"
goarm:
- 6
main: ./bin/es.go
archives:
- replacements:
darwin: Darwin
linux: Linux
386: i386
amd64: x86_64
checksum:
name_template: 'checksums.txt'
snapshot:
name_template: "{{ incpatch .Tag }}-next"
changelog:
sort: asc
filters:
exclude:
- '^docs:'
- '^test:'
brews:
- tap:
owner: kreuzwerker
name: homebrew-taps
token: "{{ .Env.GORELEASER_TOKEN }}"
homepage: "https://github.com/kreuzwerker/envsec"
description: "git@github.com:kreuzwerker/envsec.git."
68 changes: 0 additions & 68 deletions Godeps/Godeps.json

This file was deleted.

5 changes: 0 additions & 5 deletions Godeps/Readme

This file was deleted.

24 changes: 7 additions & 17 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,25 +1,15 @@
VERSION := "1.1.0"
VERSION := $(shell git describe --abbrev=7 --always)
REPO := envsec
USER := kreuzwerker
FLAGS := "-X=main.build=`git rev-parse --short HEAD` -X=main.version=$(VERSION)"

GITHUB_TOKEN ?= $(shell cat .token)
export GITHUB_TOKEN
FLAGS := "-X=main.build=$(VERSION) -X=main.version=$(VERSION)"

.PHONY: build clean release retract

build:
cd bin && gox -osarch="linux/amd64 linux/arm darwin/amd64" -ldflags $(FLAGS) -output "../build/{{.OS}}-{{.Arch}}/es";
mkdir -p build
GOOS=linux GOARCH=amd64 go build -ldflags $(FLAGS) -o build/linux-amd64/ep bin/es.go
GOOS=linux GOARCH=arm go build -ldflags $(FLAGS) -o build/linux-arm/ep bin/es.go
GOOS=darwin GOARCH=amd64 go build -ldflags $(FLAGS) -o build/darwin-amd64/ep bin/es.go

clean:
rm -rf build

release: clean build
git tag $(VERSION) -f && git push --tags -f
github-release release --user $(USER) --repo $(REPO) --tag $(VERSION)
github-release upload --user $(USER) --repo $(REPO) --tag $(VERSION) --name es-linux --file build/linux-amd64/es
github-release upload --user $(USER) --repo $(REPO) --tag $(VERSION) --name es-linux-arm --file build/linux-arm/es
github-release upload --user $(USER) --repo $(REPO) --tag $(VERSION) --name es-osx --file build/darwin-amd64/es

retract:
github-release delete --tag $(VERSION)
rm -rf build
21 changes: 21 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
module github.com/kreuzwerker/envsec

go 1.17

require (
github.com/aws/aws-sdk-go v1.41.6
github.com/joho/godotenv v1.4.0
github.com/spf13/cobra v1.2.1
github.com/stretchr/testify v1.7.0
github.com/yawn/doubledash v0.0.0-20151212175516-fd8a81db93af
github.com/yawn/envmap v0.0.0-20160813152305-a78254303070
)

require (
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/inconshreveable/mousetrap v1.0.0 // indirect
github.com/jmespath/go-jmespath v0.4.0 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect
)
Loading

0 comments on commit 179e9b0

Please sign in to comment.