Skip to content

Commit 71cf685

Browse files
committed
Initial commit
0 parents  commit 71cf685

File tree

15 files changed

+633
-0
lines changed

15 files changed

+633
-0
lines changed

.github/dependabot.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: "github-actions"
4+
directory: "/"
5+
schedule:
6+
interval: "daily"
7+
pull-request-branch-name:
8+
separator: "-"
9+
- package-ecosystem: "gomod"
10+
directory: "/"
11+
schedule:
12+
interval: "daily"
13+
pull-request-branch-name:
14+
separator: "-"

.github/release-drafter.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# Configuration for Release Drafter: https://github.com/toolmantim/release-drafter
2+
name-template: 'v$NEXT_PATCH_VERSION 🌈'
3+
tag-template: 'v$NEXT_PATCH_VERSION'
4+
version-template: $MAJOR.$MINOR.$PATCH
5+
# Emoji reference: https://gitmoji.carloscuesta.me/
6+
categories:
7+
- title: '🚀 Features'
8+
labels:
9+
- 'feature'
10+
- 'enhancement'
11+
- title: '🐛 Bug Fixes'
12+
labels:
13+
- 'fix'
14+
- 'bugfix'
15+
- 'bug'
16+
- 'regression'
17+
- title: 📝 Documentation updates
18+
label: documentation
19+
- title: 👻 Maintenance
20+
labels:
21+
- chore
22+
- dependencies
23+
- title: 🚦 Tests
24+
labels:
25+
- test
26+
- tests
27+
exclude-labels:
28+
- reverted
29+
- no-changelog
30+
- skip-changelog
31+
- invalid
32+
change-template: '* $TITLE (#$NUMBER) @$AUTHOR'
33+
template: |
34+
## What’s Changed
35+
36+
$CHANGES

.github/settings.yml

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
repository:
2+
name: github-go
3+
description: This is a template project
4+
homepage: https://github.com/linuxsuren
5+
private: false
6+
has_issues: true
7+
has_wiki: false
8+
has_downloads: false
9+
default_branch: master
10+
allow_squash_merge: true
11+
allow_merge_commit: true
12+
allow_rebase_merge: true
13+
labels:
14+
- name: newbie
15+
color: abe7f4
16+
description: 新手上路
17+
- name: bug
18+
color: d73a4a
19+
description: Something isn't working
20+
- name: feature
21+
color: ffc6a3
22+
- name: enhancement
23+
color: a2eeef
24+
description: New feature or request
25+
- name: help wanted
26+
color: 008672
27+
description: Extra attention is needed
28+
- name: bugfix
29+
color: 0412d6
30+
- name: regression
31+
color: c5def5
32+
- name: documentation
33+
color: 5ce05e
34+
- name: Hacktoberfest
35+
description: More details from https://hacktoberfest.digitalocean.com/
36+
color: 5ce05e
37+
- name: test
38+
color: c2c2fc
39+
- name: chore
40+
color: c2c2fc
41+
- name: dependencies
42+
color: 0366d6
43+
description: Pull requests that update a dependency file
44+
- name: no-changelog
45+
color: c2c2fc
46+
branches:
47+
- name: master
48+
protection:
49+
required_pull_request_reviews:
50+
required_approving_review_count: 1
51+
dismiss_stale_reviews: true
52+
require_code_owner_reviews: true
53+
dismissal_restrictions:
54+
users: []
55+
teams: []
56+
required_status_checks:
57+
strict: true
58+
contexts: []
59+
enforce_admins: false
60+
restrictions:
61+
users: []
62+
teams: []

.github/workflows/backup.yaml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: Backup Git repository
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
branches:
7+
- master
8+
9+
jobs:
10+
BackupGit:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/[email protected]
14+
- name: backup
15+
uses: jenkins-zh/[email protected]
16+
env:
17+
GIT_DEPLOY_KEY: ${{ secrets.GIT_DEPLOY_KEY }}
18+
TARGET_GIT: "[email protected]:linuxsuren/github-go.git"

.github/workflows/pull-request.yaml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: Pull Request Build
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- master
7+
8+
jobs:
9+
build:
10+
name: Build
11+
runs-on: macos-10.15
12+
steps:
13+
- name: Set up Go 1.13
14+
uses: actions/[email protected]
15+
with:
16+
go-version: 1.13
17+
id: go
18+
- name: Check out code into the Go module directory
19+
uses: actions/[email protected]
20+
- name: Run GoReleaser
21+
uses: goreleaser/[email protected]
22+
with:
23+
version: latest
24+
args: check
25+
- name: Build
26+
run: |
27+
go build
28+
GoLint:
29+
name: Lint
30+
runs-on: ubuntu-latest
31+
steps:
32+
- name: Set up Go 1.13
33+
uses: actions/[email protected]
34+
with:
35+
go-version: 1.13
36+
id: go
37+
- name: Check out code into the Go module directory
38+
uses: actions/[email protected]
39+
- name: Go-linter-1
40+
uses: Jerome1337/[email protected]
41+
with:
42+
golint-path: ./...

.github/workflows/release.yaml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- '*'
7+
8+
jobs:
9+
goreleaser:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout
13+
uses: actions/[email protected]
14+
- name: Unshallow
15+
run: git fetch --prune --unshallow
16+
- name: Set up Go
17+
uses: actions/[email protected]
18+
with:
19+
go-version: 1.13.x
20+
- name: Run GoReleaser
21+
uses: goreleaser/[email protected]
22+
with:
23+
version: latest
24+
args: release --rm-dist
25+
env:
26+
GITHUB_TOKEN: ${{ secrets.GH_PUBLISH_SECRETS }}

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
.idea/
2+
bin/

.goreleaser.yml

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
# Official documentation at http://goreleaser.com
2+
project_name: github-go
3+
builds:
4+
- env:
5+
- CGO_ENABLED=0
6+
binary: github-go
7+
goarch:
8+
- amd64
9+
- arm64
10+
goos:
11+
- windows
12+
- linux
13+
- darwin
14+
hooks:
15+
post:
16+
- upx "{{ .Path }}"
17+
ldflags:
18+
- -X github.com/linuxsuren/cgit/app.version={{.Version}}
19+
- -X github.com/linuxsuren/cgit/app.commit={{.ShortCommit}}
20+
- -X github.com/linuxsuren/cgit/app.date={{.Date}}
21+
- -w
22+
dist: release
23+
archives:
24+
- name_template: "{{ .Binary }}-{{ .Os }}-{{ .Arch }}"
25+
replacements:
26+
darwin: darwin
27+
linux: linux
28+
windows: windows
29+
amd64: amd64
30+
arm64: arm64
31+
format_overrides:
32+
- goos: windows
33+
format: zip
34+
files:
35+
- README.md
36+
checksum:
37+
name_template: 'checksums.txt'
38+
snapshot:
39+
name_template: "{{ .Tag }}-next-{{.ShortCommit}}"
40+
changelog:
41+
skip: true
42+
sort: asc
43+
filters:
44+
exclude:
45+
- '^docs:'
46+
- '^test:'
47+
brews:
48+
-
49+
name: github-go
50+
tap:
51+
owner: linuxsuren
52+
name: homebrew-linuxsuren
53+
folder: Formula
54+
homepage: "https://github.com/linuxsuren/github-go"
55+
description: cgit is a tiny tool for Chinese developers.
56+
dependencies:
57+
- name: vim
58+
type: optional
59+
- name: bash-completion
60+
type: optional
61+
test: |
62+
version_output = shell_output("#{bin}/github-go version")
63+
assert_match version.to_s, version_output
64+
install: |
65+
bin.install name
66+
67+
prefix.install_metafiles
68+
nfpms:
69+
- file_name_template: "{{ .Binary }}-{{.Os}}-{{.Arch}}"
70+
homepage: https://github.com/linuxsuren/github-go
71+
description: cgit is a tiny tool for Chinese developers.
72+
maintainer: rick <[email protected]>
73+
license: MIT
74+
vendor: Jenkins
75+
formats:
76+
- deb
77+
- rpm
78+
recommends:
79+
- bash-completion
80+
- vim
81+
bindir: /usr/bin
82+
replacements:
83+
amd64: 64bit
84+
arm64: arm64
85+
darwin: macOS
86+
linux: linux
87+
windows: windows

Makefile

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
build: fmt
2+
CGO_ENABLE=0 go build -ldflags "-w -s" -o bin/github-go
3+
4+
run:
5+
go run main.go
6+
7+
fmt:
8+
go fmt ./...
9+
10+
copy: build
11+
sudo cp bin/github-go /usr/local/bin/github-go

README.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
[![](https://goreportcard.com/badge/linuxsuren/github-go)](https://goreportcard.com/report/linuxsuren/github-go)
2+
[![](http://img.shields.io/badge/godoc-reference-5272B4.svg?style=flat-square)](https://godoc.org/github.com/linuxsuren/github-go)
3+
[![Contributors](https://img.shields.io/github/contributors/linuxsuren/github-go.svg)](https://github.com/linuxsuren/github-go/graphs/contributors)
4+
[![GitHub release](https://img.shields.io/github/release/linuxsuren/github-go.svg?label=release)](https://github.com/linuxsuren/github-go/releases/latest)
5+
![GitHub All Releases](https://img.shields.io/github/downloads/linuxsuren/github-go/total)
6+
7+
# Get started
8+
9+
You can use this template repository via the following command:
10+
11+
`gh repo create --public -p linuxsuren/github-go -y <project-name>`
12+
13+
# Clean
14+
15+
Please run the following command, after you created your project base on this template repository:
16+
17+
`./hack/init.sh <project-name>`

go.mod

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
module github.com/linuxsuren/github-go
2+
3+
go 1.15
4+
5+
require github.com/spf13/cobra v1.1.1

0 commit comments

Comments
 (0)