Skip to content

Commit

Permalink
chore(ci): update release process (#40)
Browse files Browse the repository at this point in the history
* chore(ci): add gh actions and templates
* chore: remove travis
* chore(ci): add goreleaser
* fix(makefile): remove old release logic

Closes #28 as well.
  • Loading branch information
mavogel authored Oct 15, 2021
1 parent 67b2632 commit 39eb681
Show file tree
Hide file tree
Showing 9 changed files with 193 additions and 23 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}
- envplate 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: macos-11
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: macos-11
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 }}
29 changes: 29 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: tests

on:
push:
branches:
- master
paths-ignore:
- 'README.md'
pull_request:
types: ['opened', 'synchronize']
paths-ignore:
- 'README.md'
jobs:
unit:
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: Setup Prerequisites
run: |
chmod 765 test/filemode.txt
- name: Run tests
run: make test
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
build/
dist
.token
.vscode
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/ep.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/envplate"
description: "Docker-friendly trivial templating for configuration files using environment keys."
9 changes: 0 additions & 9 deletions .travis.yml

This file was deleted.

18 changes: 4 additions & 14 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
VERSION := "0.1.0"
REPO := envplate
USER := kreuzwerker
TOKEN = `cat .token`
FLAGS := "-X=main.build=`git rev-parse --short HEAD` -X=main.version=$(VERSION)"

.PHONY: build clean test release retract
.PHONY: build clean test

build:
mkdir -p build
Expand All @@ -14,14 +12,6 @@ build:

clean:
rm -rf build

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

retract:
github-release delete --tag $(VERSION) -s $(TOKEN)

test:
go test -cover

0 comments on commit 39eb681

Please sign in to comment.