mirror of
https://github.com/Threnklyn/jira.git
synced 2026-06-07 13:33:32 +02:00
cicd: automated changelog and release
Signed-off-by: ldelossa <ldelossa@redhat.com>
This commit is contained in:
committed by
Louis DeLosSantos
parent
578c44c628
commit
31f7b03978
Executable
+60
@@ -0,0 +1,60 @@
|
|||||||
|
{{ if .Versions -}}
|
||||||
|
<a name="unreleased"></a>
|
||||||
|
## [Unreleased]
|
||||||
|
|
||||||
|
{{ if .Unreleased.CommitGroups -}}
|
||||||
|
{{ range .Unreleased.CommitGroups -}}
|
||||||
|
### {{ .Title }}
|
||||||
|
{{ range .Commits -}}
|
||||||
|
- [{{.Hash.Short}}]({{ $.Info.RepositoryURL }}/commit/{{ .Hash.Long }}): {{ .Subject }}
|
||||||
|
{{ if .Refs -}}{{ range .Refs }} -{{if .Action}}{{ .Action }} {{ end }} [#{{ .Ref }}]({{ $.Info.RepositoryURL }}/issues/{{ .Ref }}){{ end -}}
|
||||||
|
{{ end -}}
|
||||||
|
{{ end -}}
|
||||||
|
{{ end -}}
|
||||||
|
{{ end -}}
|
||||||
|
|
||||||
|
{{ range .Versions }}
|
||||||
|
<a name="{{ .Tag.Name }}"></a>
|
||||||
|
## {{ if .Tag.Previous }}[{{ .Tag.Name }}]{{ else }}{{ .Tag.Name }}{{ end }} - {{ datetime "2006-01-02" .Tag.Date }}
|
||||||
|
{{ range .CommitGroups -}}
|
||||||
|
### {{ .Title }}
|
||||||
|
{{ range .Commits -}}
|
||||||
|
- [{{.Hash.Short}}]({{ $.Info.RepositoryURL }}/commit/{{ .Hash.Long }}): {{ .Subject }}
|
||||||
|
{{ if .Refs -}}{{ range .Refs }} - {{if .Action}}{{ .Action }}{{ end }} [#{{ .Ref }}]({{ $.Info.RepositoryURL }}/issues/{{ .Ref }}){{ end -}}
|
||||||
|
{{ end -}}
|
||||||
|
{{ end -}}
|
||||||
|
{{ end -}}
|
||||||
|
|
||||||
|
{{- if .RevertCommits -}}
|
||||||
|
### Reverts
|
||||||
|
{{ range .RevertCommits -}}
|
||||||
|
- {{ .Revert.Header }}
|
||||||
|
{{ end }}
|
||||||
|
{{ end -}}
|
||||||
|
|
||||||
|
{{- if .MergeCommits -}}
|
||||||
|
### Pull Requests
|
||||||
|
{{ range .MergeCommits -}}
|
||||||
|
- {{ .Header }}
|
||||||
|
{{ end }}
|
||||||
|
{{ end -}}
|
||||||
|
|
||||||
|
{{- if .NoteGroups -}}
|
||||||
|
{{ range .NoteGroups -}}
|
||||||
|
### {{ .Title }}
|
||||||
|
{{ range .Notes }}
|
||||||
|
{{ .Body }}
|
||||||
|
{{ end }}
|
||||||
|
{{ end -}}
|
||||||
|
{{ end -}}
|
||||||
|
{{ end -}}
|
||||||
|
|
||||||
|
{{- if .Versions }}
|
||||||
|
[Unreleased]: {{ .Info.RepositoryURL }}/compare/{{ $latest := index .Versions 0 }}{{ $latest.Tag.Name }}...HEAD
|
||||||
|
{{ range .Versions -}}
|
||||||
|
{{ if .Tag.Previous -}}
|
||||||
|
[{{ .Tag.Name }}]: {{ $.Info.RepositoryURL }}/compare/{{ .Tag.Previous.Name }}...{{ .Tag.Name }}
|
||||||
|
{{ end -}}
|
||||||
|
{{ end -}}
|
||||||
|
{{ end -}}
|
||||||
|
{{ end -}}
|
||||||
Executable
+29
@@ -0,0 +1,29 @@
|
|||||||
|
style: github
|
||||||
|
template: CHANGELOG.tpl.md
|
||||||
|
info:
|
||||||
|
title: CHANGELOG
|
||||||
|
repository_url: https://github.com/go-jira/go-jira
|
||||||
|
options:
|
||||||
|
commits:
|
||||||
|
sort_by: Scope
|
||||||
|
commit_groups:
|
||||||
|
group_by: Scope
|
||||||
|
header:
|
||||||
|
pattern: '^(.*):\s*(.*)$'
|
||||||
|
pattern_maps:
|
||||||
|
- Scope
|
||||||
|
- Subject
|
||||||
|
issues:
|
||||||
|
prefix:
|
||||||
|
- "#"
|
||||||
|
|
||||||
|
refs:
|
||||||
|
actions:
|
||||||
|
- Closes
|
||||||
|
- Fixes
|
||||||
|
- PullRequest
|
||||||
|
|
||||||
|
notes:
|
||||||
|
keywords:
|
||||||
|
- BREAKING CHANGE
|
||||||
|
- NOTE
|
||||||
@@ -0,0 +1,40 @@
|
|||||||
|
---
|
||||||
|
name: Prepare Release
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
|
inputs:
|
||||||
|
branch:
|
||||||
|
description: 'the branch to prepare the release against'
|
||||||
|
required: true
|
||||||
|
deault: 'master'
|
||||||
|
tag:
|
||||||
|
description: 'the tag to be released'
|
||||||
|
required: true
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
prepare:
|
||||||
|
name: Prepare Release
|
||||||
|
runs-on: 'ubuntu-latest'
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
ref: ${{ github.event.inputs.branch }}
|
||||||
|
- name: Changelog
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
curl -o /tmp/git-chglog -L https://github.com/git-chglog/git-chglog/releases/download/0.9.1/git-chglog_linux_amd64
|
||||||
|
chmod u+x /tmp/git-chglog
|
||||||
|
echo "creating change log for tag: ${{ github.event.inputs.tag }}"
|
||||||
|
/tmp/git-chglog --next-tag "${{ github.event.inputs.tag }}" -o CHANGELOG.md
|
||||||
|
- name: Create Pull Request
|
||||||
|
uses: peter-evans/create-pull-request@v3.1.2
|
||||||
|
with:
|
||||||
|
title: "${{ github.event.inputs.tag }} Changelog Bump"
|
||||||
|
body: "This is an automated changelog commit."
|
||||||
|
commit-message: "chore: ${{ github.event.inputs.tag }} changelog bump"
|
||||||
|
branch: "ready-${{ github.event.inputs.tag }}"
|
||||||
|
signoff: "gh-actions"
|
||||||
|
|
||||||
@@ -0,0 +1,97 @@
|
|||||||
|
---
|
||||||
|
name: Release
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
tags:
|
||||||
|
- v1.*
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
release:
|
||||||
|
name: Release
|
||||||
|
runs-on: 'ubuntu-latest'
|
||||||
|
steps:
|
||||||
|
- name: Setup
|
||||||
|
run: |
|
||||||
|
tag=`basename ${{ github.ref }}`
|
||||||
|
cat <<.
|
||||||
|
::set-env name=VERSION::${tag}
|
||||||
|
.
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
- name: ChangeLog
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
curl -o git-chglog -L https://github.com/git-chglog/git-chglog/releases/download/0.9.1/git-chglog_linux_amd64
|
||||||
|
chmod u+x git-chglog
|
||||||
|
tag=`basename ${{ github.ref }}`
|
||||||
|
echo "creating change log for tag: $tag"
|
||||||
|
chglog="$(./git-chglog ${tag})"
|
||||||
|
chglog="${chglog//'%'/'%25'}"
|
||||||
|
chglog="${chglog//$'\n'/'%0A'}"
|
||||||
|
chglog="${chglog//$'\r'/'%0D'}"
|
||||||
|
cat <<.
|
||||||
|
::set-env name=CHANGELOG::${chglog}
|
||||||
|
.
|
||||||
|
- name: Create Release
|
||||||
|
uses: actions/create-release@latest
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
with:
|
||||||
|
tag_name: ${{ github.ref }}
|
||||||
|
release_name: ${{ env.VERSION}} Release
|
||||||
|
body: |
|
||||||
|
${{ env.CHANGELOG }}
|
||||||
|
prerelease: ${{ contains(env.VERSION, 'alpha') || contains(env.VERSION, 'beta') || contains(env.VERSION, 'rc') }}
|
||||||
|
# perform production release of artifacts
|
||||||
|
- name: Build Artifacts
|
||||||
|
run: |
|
||||||
|
VERSION=${{ env.VERSION }} make all
|
||||||
|
- name: "Publish Darwin AMD64"
|
||||||
|
uses: actions/upload-release-asset@v1
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
with:
|
||||||
|
upload_url: ${{ github.event.release.upload_url }}
|
||||||
|
asset_path: ./dist/github.com/go-jira/jira-drawin-amd64
|
||||||
|
asset_name: jira-drawin-amd64
|
||||||
|
asset_content_type: application/octet-stream
|
||||||
|
- name: "Publish Linux 386"
|
||||||
|
uses: actions/upload-release-asset@v1
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
with:
|
||||||
|
upload_url: ${{ github.event.release.upload_url }}
|
||||||
|
asset_path: ./dist/github.com/go-jira/jira-linux-386
|
||||||
|
asset_name: jira-linux-386
|
||||||
|
asset_content_type: application/octet-stream
|
||||||
|
- name: "Publish Linux AMD64"
|
||||||
|
uses: actions/upload-release-asset@v1
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
with:
|
||||||
|
upload_url: ${{ github.event.release.upload_url }}
|
||||||
|
asset_path: ./dist/github.com/go-jira/jira-linux-amd64
|
||||||
|
asset_name: jira-linux-amd64
|
||||||
|
asset_content_type: application/octet-stream
|
||||||
|
- name: "Publish Windows 386"
|
||||||
|
uses: actions/upload-release-asset@v1
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
with:
|
||||||
|
upload_url: ${{ github.event.release.upload_url }}
|
||||||
|
asset_path: ./dist/github.com/go-jira/jira-windows-386.exe
|
||||||
|
asset_name: jira-windows-386.exe
|
||||||
|
asset_content_type: application/octet-stream
|
||||||
|
- name: "Publish Windows AMD64"
|
||||||
|
uses: actions/upload-release-asset@v1
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
with:
|
||||||
|
upload_url: ${{ github.event.release.upload_url }}
|
||||||
|
asset_path: ./dist/github.com/go-jira/jira-windows-amd64.exe
|
||||||
|
asset_name: jira-windows-amd64.exe
|
||||||
|
asset_content_type: application/octet-stream
|
||||||
|
|
||||||
@@ -19,6 +19,7 @@ GOBIN ?= $(CWD)
|
|||||||
|
|
||||||
CURVER ?= $(patsubst v%,%,$(shell [ -d .git ] && git describe --abbrev=0 --tags || grep ^\#\# CHANGELOG.md | awk '{print $$2; exit}'))
|
CURVER ?= $(patsubst v%,%,$(shell [ -d .git ] && git describe --abbrev=0 --tags || grep ^\#\# CHANGELOG.md | awk '{print $$2; exit}'))
|
||||||
LDFLAGS:= -w
|
LDFLAGS:= -w
|
||||||
|
VERSION ?= development
|
||||||
|
|
||||||
build:
|
build:
|
||||||
$(GO) build -gcflags="-e" -v -ldflags "$(LDFLAGS) -s" -o '$(BIN)' cmd/jira/main.go
|
$(GO) build -gcflags="-e" -v -ldflags "$(LDFLAGS) -s" -o '$(BIN)' cmd/jira/main.go
|
||||||
@@ -42,7 +43,7 @@ all:
|
|||||||
GO111MODULE=off $(GO) get -u github.com/mitchellh/gox
|
GO111MODULE=off $(GO) get -u github.com/mitchellh/gox
|
||||||
rm -rf dist
|
rm -rf dist
|
||||||
mkdir -p dist
|
mkdir -p dist
|
||||||
gox -ldflags="-w -s" -output="dist/github.com/go-jira/jira-{{.OS}}-{{.Arch}}" -osarch="darwin/amd64 linux/386 linux/amd64 windows/386 windows/amd64" ./cmd/jira
|
gox -ldflags="-w -s" -ldflags="-X 'github.com/go-jira/jira.VERSION=$(VERSION)'" -output="dist/github.com/go-jira/jira-{{.OS}}-{{.Arch}}" -osarch="darwin/amd64 linux/386 linux/amd64 windows/386 windows/amd64" ./cmd/jira
|
||||||
|
|
||||||
install:
|
install:
|
||||||
${MAKE} GOBIN=$$HOME/bin build
|
${MAKE} GOBIN=$$HOME/bin build
|
||||||
|
|||||||
@@ -4,7 +4,8 @@ import (
|
|||||||
"github.com/coryb/oreo"
|
"github.com/coryb/oreo"
|
||||||
)
|
)
|
||||||
|
|
||||||
const VERSION = "1.0.26"
|
// replace by ldflags
|
||||||
|
var VERSION = "development"
|
||||||
|
|
||||||
type Jira struct {
|
type Jira struct {
|
||||||
Endpoint string `json:"endpoint,omitempty" yaml:"endpoint,omitempty"`
|
Endpoint string `json:"endpoint,omitempty" yaml:"endpoint,omitempty"`
|
||||||
|
|||||||
Reference in New Issue
Block a user