Merge pull request #37 from owncloud/add-publishing-step

Add publishing to GH step without building binaries
This commit is contained in:
Michael Barz
2020-03-11 09:50:42 +01:00
committed by GitHub
4 changed files with 100 additions and 10 deletions

View File

@@ -5,6 +5,7 @@ def main(ctx):
after = [
changelog(ctx),
publish(ctx),
]
return stages + after
@@ -130,6 +131,7 @@ def testing(ctx):
}
def changelog(ctx):
repo_slug = ctx.build.source_repo if ctx.build.source_repo else ctx.repo.slug
return {
'kind': 'pipeline',
'type': 'docker',
@@ -150,8 +152,8 @@ def changelog(ctx):
'actions': [
'clone',
],
'remote': 'https://github.com/%s' % (ctx.repo.slug),
'branch': ctx.build.branch if ctx.build.event == 'pull_request' else 'master',
'remote': 'https://github.com/%s' % (repo_slug),
'branch': ctx.build.source if ctx.build.event == 'pull_request' else 'master',
'path': '/drone/src',
'netrc_machine': 'github.com',
'netrc_username': {
@@ -170,6 +172,14 @@ def changelog(ctx):
'make changelog',
],
},
{
'name': 'diff',
'image': 'owncloud/alpine:latest',
'pull': 'always',
'commands': [
'git diff',
],
},
{
'name': 'output',
'image': 'webhippie/golang:1.13',
@@ -214,6 +224,58 @@ def changelog(ctx):
'trigger': {
'ref': [
'refs/heads/master',
'refs/pull/**',
],
},
}
def publish(ctx):
return {
'kind': 'pipeline',
'type': 'docker',
'name': 'publish',
'platform': {
'os': 'linux',
'arch': 'amd64',
},
'steps': [
{
'name': 'prepare',
'image': 'owncloud/alpine:latest',
'pull': 'always',
'commands': [
'mkdir -p dist',
],
},
{
'name': 'changelog',
'image': 'toolhippie/calens:latest',
'pull': 'always',
'commands': [
'calens --version %s -o dist/CHANGELOG.md' % ctx.build.ref.replace("refs/tags/v", "").split("-")[0],
],
},
{
'name': 'release',
'image': 'plugins/github-release:1',
'pull': 'always',
'settings': {
'api_key': {
'from_secret': 'github_token',
},
'files': [],
'title': ctx.build.ref.replace("refs/tags/v", ""),
'note': 'dist/CHANGELOG.md',
'overwrite': True,
'prerelease': len(ctx.build.ref.split("-")) > 1,
},
},
],
'depends_on': [
'testing',
],
'trigger': {
'ref': [
'refs/tags/**',
],
},

View File

@@ -1,6 +1,8 @@
SHELL := bash
NAME := ocis-pkg
IMPORT := github.com/owncloud/$(NAME)
BIN := bin
DIST := dist
ifeq ($(OS), Windows_NT)
UNAME := Windows
@@ -33,6 +35,7 @@ sync:
.PHONY: clean
clean:
go clean -i ./...
rm -rf $(BIN) $(DIST)
.PHONY: fmt
fmt:

View File

@@ -1,18 +1,43 @@
{{- range $changes := . }}{{ with $changes -}}
# Changelog for {{ .Version }}
{{ $allVersions := . }}
{{- range $index, $changes := . }}{{ with $changes -}}
{{ if gt (len $allVersions) 1 -}}
# Changelog for [{{ .Version }}] ({{ .Date }})
The following sections list the changes for {{ .Version }}.
The following sections list the changes in ocis-pkg {{ .Version }}.
{{/* creating version compare links */ -}}
{{ $next := add1 $index -}}
{{ if ne (len $allVersions) $next -}}
{{ $previousVersion := (index $allVersions $next).Version -}}
{{ if eq .Version "unreleased" -}}
[{{ .Version }}]: https://github.com/owncloud/ocis-pkg/compare/v{{ $previousVersion }}...master
{{ else -}}
[{{ .Version }}]: https://github.com/owncloud/ocis-pkg/compare/v{{ $previousVersion }}...v{{ .Version }}
{{ end -}}
{{ end -}}
{{- /* last version managed by calens, end of the loop */ -}}
{{ if eq .Version "1.0.0" -}}
[{{ .Version }}]: https://github.com/owncloud/ocis-pkg/compare/63fa90a673cbc3238a503ea5e6304f1db7fdf47b...v{{ .Version }}
{{ end -}}
{{ else -}}
# Changes in {{ .Version }}
{{ end -}}
## Summary
{{ range $entry := .Entries }}{{ with $entry }}
* {{ .TypeShort }} #{{ .PrimaryID }}: {{ .Title }}
* {{ .Type }} - {{ .Title }}: [#{{ .PrimaryID }}]({{ .PrimaryURL }})
{{- end }}{{ end }}
## Details
{{ range $entry := .Entries }}{{ with $entry }}
* {{ .Type }} #{{ .PrimaryID }}: {{ .Title }}
* {{ .Type }} - {{ .Title }}: [#{{ .PrimaryID }}]({{ .PrimaryURL }})
{{ range $par := .Paragraphs }}
{{ wrap $par 80 3 }}
{{ wrapIndent $par 80 3 }}
{{ end -}}
{{ range $url := .IssueURLs }}
{{ $url -}}
@@ -23,6 +48,6 @@ The following sections list the changes for {{ .Version }}.
{{ range $url := .OtherURLs }}
{{ $url -}}
{{ end }}
{{ end }}{{ end }}
{{ end }}{{ end -}}
{{ end }}{{ end -}}

View File

@@ -1,4 +1,4 @@
Feature: Tracing middleware
Enhancement: Tracing middleware
A new tracing middleware has been added to unpack context propagation