Skip to content

Commit 789780c

Browse files
authored
[SRE-1448] Update github-flow-manager to check github actions by workflow name (#10)
1 parent d3a38b2 commit 789780c

File tree

14 files changed

+420
-160
lines changed

14 files changed

+420
-160
lines changed

.github/workflows/release.yaml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: release-build
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
8+
env:
9+
REGISTRY: ghcr.io
10+
IMAGE_NAME: ${{ github.repository }}
11+
12+
jobs:
13+
release:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: Checkout
17+
uses: actions/checkout@v2
18+
19+
- name: Unshallow
20+
run: git fetch --prune --unshallow
21+
22+
- name: Set up Go
23+
uses: actions/setup-go@v1
24+
with:
25+
go-version: 1.16.x
26+
27+
- name: Run GoReleaser
28+
uses: goreleaser/goreleaser-action@v1
29+
with:
30+
version: v2.9.1
31+
args: release --rm-dist
32+
env:
33+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.gitignore

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,21 @@
1-
.idea/
2-
vendor/
3-
4-
/.vscode/launch.json
1+
# Binaries for programs and plugins
2+
*.exe
3+
*.exe~
4+
*.dll
5+
*.so
6+
*.dylib
7+
8+
# Test binary, built with `go test -c`
9+
*.test
10+
11+
# Output of the go coverage tool, specifically when used with LiteIDE
12+
*.out
13+
14+
# VisualStudioCode
15+
.vscode/*
16+
17+
### Intellij ###
18+
.idea
19+
20+
# Generated binary files
21+
bin

.goreleaser.yml

Lines changed: 52 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
project_name: github-flow-manager
2+
13
builds:
24
- binary: github-flow-manager
35
env:
@@ -9,7 +11,55 @@ builds:
911
- linux
1012
goarch:
1113
- amd64
14+
- arm64
15+
16+
archives:
17+
- format_overrides:
18+
- goos: windows
19+
format: zip
20+
builds:
21+
- github-flow-manager
22+
replacements:
23+
amd64: 64-bit
24+
darwin: macOS
25+
26+
release:
27+
github:
28+
owner: DocPlanner
29+
name: github-flow-manager
30+
31+
nfpms:
32+
- id: github-flow-manager
33+
builds:
34+
- github-flow-manager
35+
formats:
36+
- deb
37+
vendor: DocPlanner
38+
homepage: https://github.com/DoccPlanner/github-flow-manager
39+
maintainer: DevOps Team <[email protected]>
40+
description: Push commits between branches but just those which pass evaluation checks
41+
1242
dockers:
1343
- image_templates:
14-
- "docplanner/github-flow-manager:latest"
15-
- "docplanner/github-flow-manager:{{ .Tag }}"
44+
- docplanner/github-flow-manager:{{ trimprefix .Tag "v" }}-amd64
45+
goarch: amd64
46+
dockerfile: Dockerfile
47+
use: buildx
48+
build_flag_templates:
49+
- --platform=linux/amd64
50+
- image_templates:
51+
- docplanner/github-flow-manager:{{ trimprefix .Tag "v" }}-arm64
52+
goarch: arm64
53+
dockerfile: Dockerfile
54+
use: buildx
55+
build_flag_templates:
56+
- --platform=linux/arm64/v8
57+
docker_manifests:
58+
- name_template: docplanner/github-flow-manager:{{ trimprefix .Tag "v" }}
59+
image_templates:
60+
- docplanner/github-flow-manager:{{ trimprefix .Tag "v" }}-amd64
61+
- docplanner/github-flow-manager:{{ trimprefix .Tag "v" }}-arm64
62+
- name_template: docplanner/github-flow-manager:latest
63+
image_templates:
64+
- docplanner/github-flow-manager:{{ trimprefix .Tag "v" }}-amd64
65+
- docplanner/github-flow-manager:{{ trimprefix .Tag "v" }}-arm64

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
FROM alpine:3.7
22
RUN apk add --no-cache ca-certificates
33
COPY github-flow-manager /
4-
ENTRYPOINT ["/github-flow-manager"]
4+
ENTRYPOINT ["/github-flow-manager"]

README.md

Lines changed: 69 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,34 @@
1+
[![Tests][tests-badge]][tests-link]
2+
[![GitHub Release][release-badge]][release-link]
3+
[![Go Report Card][report-badge]][report-link]
4+
[![License][license-badge]][license-link]
5+
16
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
27
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
3-
**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)*
8+
**Table of Contents**
49

510
- [github-flow-manager](#github-flow-manager)
611
- [Help](#help)
712
- [Example](#example)
813
- [Pre commit](#pre-commit)
9-
- [Expressions](#expressions)
14+
- [Expressions](#expressions)
1015
- [Available variables](#available-variables)
11-
- [Examples](#examples)
16+
- [Examples](#examples)
17+
- [Commit message contains "string"](#commit-message-contains-string)
18+
- [Commit message not contains "string"](#commit-message-not-contains-string)
19+
- [Commit message equals "string"](#commit-message-equals-string)
20+
- [Commit status is SUCCESS](#commit-status-is-success)
21+
- [Commit was pushed more than 30 minutes ago](#commit-was-pushed-more-than-30-minutes-ago)
22+
- [Commit was pushed more than 30 minutes ago and status is SUCCESS](#commit-was-pushed-more-than-30-minutes-ago-and-status-is-success)
1223
- [How to build](#how-to-build)
1324

1425
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
1526

1627
# github-flow-manager
28+
1729
## Help
18-
```
30+
31+
```sh
1932
Main goal for that app is to push commits between branches
2033
but just those which pass evaluation checks.
2134
Example use case "push all commits pushed to branch develop more than 30 minutes ago to branch master"
@@ -34,64 +47,91 @@ Flags:
3447
```
3548
3649
## Example
50+
3751
- Evaluating commit status success based on the cumulative commit checks result
38-
```
52+
53+
```sh
3954
GITHUB_TOKEN=xxx github-flow-manager octocat Hello-World test master "StatusSuccess == false" --verbose --dry-run
4055
```
56+
4157
- Passing specific commit check name for the evaluation of the status success of the commit
42-
```
58+
59+
```sh
4360
GITHUB_TOKEN=xxx github-flow-manager octocat Hello-World test master "StatusSuccess == false" "pipeline-name-to-be-checked" --verbose --dry-run
4461
GITHUB_TOKEN=xxx github-flow-manager octocat Hello-World test master "StatusSuccess == false" "pipeline-1-name-to-be-checked,pipeline-2-name-to-be-checked" --verbose --dry-run
4562
```
4663
4764
## Pre commit
4865
4966
This repo leverage pre commit to lint, secure, document the IaaC codebase. The pre-commit configuration require the following dependencies:
67+
5068
- [pre-commit](https://pre-commit.com/#install)
5169
- [golangci-lint](https://golangci-lint.run/usage/install/#local-installation)
5270
5371
**One first repo download, to install the pre-commit hooks run**: `pre-commit install`, to run the hooks at will run: `pre-commit run -a`
5472
55-
# Expressions
73+
## Expressions
74+
5675
### Available variables
57-
- `SHA`
58-
- `Message`
59-
- `PushedDate` - when commit was pushed
60-
- `StatusSuccess` - f.ex. CI status
6176
62-
### Examples
63-
##### Commit message contains "string"
77+
- `SHA`
78+
- `Message`
79+
- `PushedDate` - when commit was pushed
80+
- `StatusSuccess` - f.ex. CI status
81+
82+
## Examples
83+
84+
### Commit message contains "string"
85+
6486
`Message contains "HOTFIX"`
65-
##### Commit message not contains "string"
87+
88+
### Commit message not contains "string"
89+
6690
`Message NOT contains "FEATURE"`
67-
##### Commit message equals "string"
91+
92+
### Commit message equals "string"
93+
6894
`Message == "very important commit"`
69-
##### Commit status is SUCCESS
95+
96+
### Commit status is SUCCESS
97+
7098
`StatusSuccess == true`
71-
##### Commit was pushed more than 30 minutes ago
99+
100+
### Commit was pushed more than 30 minutes ago
101+
72102
`PushedDate < "now-30m"`
73-
##### Commit was pushed more than 30 minutes ago and status is SUCCESS
103+
104+
### Commit was pushed more than 30 minutes ago and status is SUCCESS
105+
74106
`PushedDate < "now-30m" AND StatusSuccess == true`
75107
76108
## How to build
77109
78110
You will need:
79-
* `goreleaser` binary
80-
* Github access using token
81-
* Docker image push access
111+
112+
- Permissions to create tags in `master` branch
82113
83114
Check tags
84-
```
115+
116+
```sh
85117
git tag
86118
```
87119
88-
Tag your changes
89-
```
120+
Tag your changes to create a new release with the tag specified:
121+
122+
```sh
90123
git tag -a v1.0.X -m "fix"
91124
```
92125
93-
Release
94-
Note: you should generate your Personal Access Token with `write packages` scope enabled
95-
```
96-
GITHUB_TOKEN=<PERSONAL_ACCESS_TOKEN> goreleaser release
97-
```
126+
<!-- JUST BADGES & LINKS -->
127+
[tests-badge]: https://img.shields.io/github/workflow/status/DocPlanner/github-flow-manager/Tests
128+
[tests-link]: https://github.com/DocPlanner/github-flow-manager/actions?query=workflow%3ATests
129+
130+
[release-badge]: https://img.shields.io/github/release/DocPlanner/github-flow-manager.svg?logo=github&labelColor=262b30
131+
[release-link]: https://github.com/DocPlanner/github-flow-manager/releases
132+
133+
[report-badge]: https://goreportcard.com/badge/github.com/DocPlanner/github-flow-manager
134+
[report-link]: https://goreportcard.com/report/github.com/DocPlanner/github-flow-manager
135+
136+
[license-badge]: https://img.shields.io/github/license/DocPlanner/github-flow-manager
137+
[license-link]: https://github.com/DocPlanner/github-flow-manager/blob/master/LICENSE

0 commit comments

Comments
 (0)