Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add changelog for releases #7

Merged
merged 8 commits into from
Dec 23, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions .chglog/CHANGELOG.tpl.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{{ range .Versions }}
<a name="{{ .Tag.Name }}"></a>
## {{ if .Tag.Previous }}[{{ .Tag.Name }}]({{ $.Info.RepositoryURL }}/compare/{{ .Tag.Previous.Name }}...{{ .Tag.Name }}){{ else }}{{ .Tag.Name }}{{ end }} ({{ datetime "2006-01-02" .Tag.Date }})

{{ range .CommitGroups -}}
### {{ .Title }}

{{ range .Commits -}}
* {{ if .Scope }}**{{ .Scope }}:** {{ end }}{{ .Subject }}
{{ end }}
{{ end -}}

{{- if .RevertCommits -}}
### Reverts

{{ range .RevertCommits -}}
* {{ .Revert.Header }}
{{ end }}
{{ end -}}

{{- if .NoteGroups -}}
{{ range .NoteGroups -}}
### {{ .Title }}

{{ range .Notes }}
{{ .Body }}
{{ end }}
{{ end -}}
{{ end -}}
{{ end -}}
28 changes: 28 additions & 0 deletions .chglog/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
style: github
template: CHANGELOG.tpl.md
info:
title: CHANGELOG
repository_url: https://github.com/go-vela/vela-git
options:
commits:
# filters:
# Type:
# - feat
# - fix
# - perf
# - refactor
commit_groups:
# title_maps:
# feat: Features
# fix: Bug Fixes
# perf: Performance Improvements
# refactor: Code Refactoring
header:
pattern: "^(\\w*)(?:\\(([\\w\\$\\.\\-\\*\\s]*)\\))?\\:\\s(.*)$"
pattern_maps:
- Type
- Scope
- Subject
notes:
keywords:
- BREAKING CHANGE
6 changes: 5 additions & 1 deletion .github/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
# Git
# vela-git

[![GoDoc](https://godoc.org/github.com/go-vela/vela-git?status.svg)](https://godoc.org/github.com/go-vela/vela-git)
[![Go Report Card](https://goreportcard.com/badge/go-vela/vela-git)](https://goreportcard.com/report/go-vela/vela-git)
[![codecov](https://codecov.io/gh/go-vela/vela-git/branch/master/graph/badge.svg)](https://codecov.io/gh/go-vela/vela-git)

Git plugin built around the [git](https://git-scm.com/) CLI to clone repositories for Vela.

Expand Down
10 changes: 7 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,21 @@
name: Build Action
# name of the action
name: build

# trigger on pull_request or push events
on:
pull_request:
push:

# pipeline to execute
jobs:
build:
runs-on: ubuntu-latest
container:
image: golang:latest
steps:

- name: clone
uses: actions/checkout@v1

- name: build
run: make build
run: |
make build
37 changes: 37 additions & 0 deletions .github/workflows/prerelease.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# name of the action
name: prerelease

# trigger on push events with `v*` in tag
on:
push:
tags:
- 'v*'

# pipeline to execute
jobs:
prerelease:
runs-on: ubuntu-latest
container:
image: golang:latest
steps:
- name: clone
uses: actions/checkout@v1

- name: build
env:
GOOS: linux
CGO_ENABLED: '0'
run: |
go build -a \
-ldflags '-s -w -extldflags "-static"' \
-o release/vela-git \
github.com/go-vela/vela-git

- name: publish
uses: elgohr/Publish-Docker-Github-Action@master
with:
name: target/vela-git
cache: true
tag_names: true
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
15 changes: 11 additions & 4 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,23 +1,30 @@
name: Publish Action
# name of the action
name: publish

# trigger on push events with branch master
on:
push:
branches: [ master ]

# pipeline to execute
jobs:
publish:
runs-on: ubuntu-latest
container:
image: golang:latest
steps:

- name: clone
uses: actions/checkout@master
uses: actions/checkout@v1

- name: build
env:
GOOS: linux
CGO_ENABLED: '0'
run: go build -a -ldflags '-s -w -extldflags "-static"' -o release/vela-git github.com/go-vela/vela-git
run: |
go build -a \
-ldflags '-s -w -extldflags "-static"' \
-o release/vela-git \
github.com/go-vela/vela-git

- name: publish
uses: elgohr/Publish-Docker-Github-Action@master
Expand Down
57 changes: 40 additions & 17 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,30 +1,53 @@
name: Release Action
# name of the action
name: release

# trigger on push events with `v*` in tag
# ignore push events with `v*-rc*` in tag
on:
push:
tags:
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10
- 'v*'
- '!v*-rc*'

# pipeline to execute
jobs:
release:
runs-on: ubuntu-latest
container:
image: golang:latest
steps:

- name: clone
uses: actions/checkout@master
uses: actions/checkout@v1

- name: build
env:
GOOS: linux
CGO_ENABLED: '0'
run: go build -a -ldflags '-s -w -extldflags "-static"' -o release/vela-git github.com/go-vela/vela-git
- name: tags
run: |
git fetch --tags

- name: version
id: version
run: |
echo ::set-output name=VERSION::${GITHUB_REF#refs/tags/}

- name: publish
uses: elgohr/Publish-Docker-Github-Action@master
with:
name: target/vela-git
cache: true
tag_names: true
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: install
run: |
go get github.com/git-chglog/git-chglog/cmd/git-chglog
go get github.com/itchio/gothub

- name: changelog
run: |
# https://github.com/git-chglog/git-chglog#git-chglog
$(go env GOPATH)/bin/git-chglog \
-o $GITHUB_WORKSPACE/CHANGELOG.md \
${{ steps.version.outputs.VERSION }}

- name: release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
# https://github.com/itchio/gothub#gothub
$(go env GOPATH)/bin/gothub edit \
--user go-vela \
--repo vela-git \
--tag ${{ steps.version.outputs.VERSION }} \
--name ${{ steps.version.outputs.VERSION }} \
--description "$(cat $GITHUB_WORKSPACE/CHANGELOG.md)"
16 changes: 13 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,27 @@
name: Test Action
# name of the action
name: test

# trigger on pull_request or push events
on:
pull_request:
push:

# pipeline to execute
jobs:
test:
runs-on: ubuntu-latest
container:
image: golang:latest
steps:

- name: clone
uses: actions/checkout@v1

- name: test
run: go test -cover -coverprofile coverage.out ./...
run: |
go test -race -covermode=atomic -coverprofile=coverage.out ./...

- name: coverage
uses: codecov/codecov-action@v1
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: coverage.out
7 changes: 5 additions & 2 deletions .github/workflows/validate.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
name: Validate Action
# name of the action
name: validate

# trigger on pull_request or push events
on:
pull_request:
push:

# pipeline to execute
jobs:
validate:
runs-on: ubuntu-latest
container:
image: golang:latest
steps:

- name: clone
uses: actions/checkout@v1

Expand Down
73 changes: 73 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
# This is a manually created golangci.com yaml configuration with
# some defaults explicitly provided. There is a large number of
# linters we've enabled that are usually disabled by default.
#
# https://github.com/golangci/golangci-lint#config-file

# This section provides the configuration for how golangci
# outputs it results from the linters it executes.
output:
format: colored-line-number
print-issued-lines: true
print-linter-name: true

# This section provides the configuration for which linters
# golangci will execute. Several of them were disabled by
# default but we've opted to enable them.
linters:
# disable all linters as new linters might be added to golangci
disable-all: true
enable:
# linters enabled by default
- deadcode
- errcheck
- govet
- gosimple # a.k.a. megacheck
- ineffassign
- staticcheck
- structcheck
- typecheck
- unused
- varcheck

# linters disabled by default
- bodyclose
- gocognit
- goconst
- gocyclo
- goimports
- gosec
- funlen
- maligned
- misspell
- stylecheck
- unparam
- whitespace
- wsl

# static list of linters we know golangci can run but we've
# chosen to leave disabled for now
#
# disable:
# - depguard
# - dogsled
# - dupl
# - gocritic
# - gochecknoinits
# - gochecknoglobals
# - godox
# - gofmt
# - golint
# - gomnd
# - interfacer
# - lll
# - nakedret
# - scopelint
# - unconvert

# This section provides the configuration for each linter
# we've instructed golangci to execute.
linters-settings:
funlen:
lines: 100
statements: 60
8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@ clean:
#################################
binary-build:

GOOS=linux CGO_ENABLED=0 go build -o release/git-plugin github.com/go-vela/vela-git
GOOS=linux CGO_ENABLED=0 go build -o release/vela-git github.com/go-vela/vela-git

#################################
###### Docker Build ######
#################################
docker-build:

docker build --no-cache -t git-plugin:local .
docker build --no-cache -t vela-git:local .

#################################
###### Docker Run ######
Expand All @@ -48,7 +48,7 @@ docker-run:
-e VELA_NETRC_MACHINE \
-e VELA_NETRC_USERNAME \
-e VELA_NETRC_PASSWORD \
git-plugin:local
vela-git:local

docker-example:

Expand All @@ -62,4 +62,4 @@ docker-example:
-e VELA_NETRC_MACHINE \
-e VELA_NETRC_USERNAME \
-e VELA_NETRC_PASSWORD \
git-plugin:local
vela-git:local
Loading