Skip to content

Commit 5fe8569

Browse files
committed
build: use semantic release
1 parent b40da17 commit 5fe8569

File tree

8 files changed

+99
-489
lines changed

8 files changed

+99
-489
lines changed

.github/workflows/release.yml

Lines changed: 29 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,29 @@
11
name: Release Dispatcher
22
on: workflow_dispatch
33
jobs:
4+
test:
5+
name: Test Unit
6+
strategy:
7+
matrix:
8+
os: [ ubuntu-latest, windows-latest, macos-latest ]
9+
runs-on: ${{ matrix.os }}
10+
steps:
11+
- name: Checkout
12+
uses: actions/checkout@v2
13+
with:
14+
fetch-depth: 0
15+
- name: Setup Go
16+
uses: actions/setup-go@v2
17+
with:
18+
go-version: 1.18
19+
- name: Build
20+
run: go build -v ./...
21+
- name: Test
22+
run: go test -v ./...
423
release:
524
name: Release Dispatcher
625
runs-on: ubuntu-latest
26+
needs: test
727
steps:
828
- name: Checkout
929
uses: actions/checkout@v2
@@ -13,9 +33,12 @@ jobs:
1333
uses: actions/setup-go@v2
1434
with:
1535
go-version: 1.18
16-
- name: Download SVU
17-
run: go install github.com/caarlos0/svu@latest
18-
- name: Create tag
19-
run: |
20-
git tag $(suv next)
21-
git push --tags
36+
- name: Setup Node
37+
uses: actions/setup-node@v2
38+
with:
39+
node-version: 16
40+
- name: Install GoReleaser
41+
run: go install github.com/goreleaser/goreleaser@latest
42+
- name: Create release
43+
run: npx -p @semantic-release/changelog -p @semantic-release/exec -p @semantic-release/git semantic-release --ci
44+

.github/workflows/releaser.yml

Lines changed: 0 additions & 45 deletions
This file was deleted.

.github/workflows/test.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
name: Test Unit
22
on:
33
push:
4+
tags-ignore:
5+
- "*"
46
paths-ignore:
57
- ".github/funding.yml"
68
- ".github/workflows/releaser.yml"
@@ -12,6 +14,8 @@ on:
1214
- "schema.app.manifest.json"
1315
- "schema.repo.manifest.json"
1416
pull_request:
17+
tags-ignore:
18+
- "*"
1519
paths-ignore:
1620
- ".github/funding.yml"
1721
- ".github/workflows/releaser.yml"

.goreleaser.yaml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@ before:
44
- go mod tidy
55
- go generate ./...
66
builds:
7-
- id: goo
8-
mod_timestamp: '{{ .Timestamp }}'
7+
- mod_timestamp: '{{ .Timestamp }}'
98
binary: 'bin/goo_{{ .Target }}'
109
env:
1110
- CGO_ENABLED=0
@@ -14,12 +13,15 @@ builds:
1413
- -X github.com/goo-app/cli/internal.Version={{ .Version }}
1514
- -X github.com/goo-app/cli/internal.Timestamp={{ .Timestamp }}
1615
- -X github.com/goo-app/cli/internal.Revision={{ .ShortCommit }}
17-
- -X github.com/goo-app/cli/internal.CoreRepoSlug=goo-app/package-core
18-
- -X github.com/goo-app/cli/internal.ProjectRepoSlug=goo-app/cli
16+
- -X github.com/goo-app/cli/internal.CoreRepoSlug=goo-app-manager/main
17+
- -X github.com/goo-app/cli/internal.ProjectRepoSlug=goo-app-manager/goo
1918
goos:
2019
- linux
2120
- windows
2221
- darwin
22+
archives:
23+
- format: binary
24+
name_template: '{{ .Binary }}_{{ .Os }}_{{ .Arch }}'
2325
checksum:
2426
name_template: 'checksums.txt'
2527
changelog:

.releaserc.json

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
{
2+
"preset": "angular",
3+
"branches": "main",
4+
"plugins": [
5+
["@semantic-release/commit-analyzer", {
6+
"preset": "conventionalcommits",
7+
"releaseRules": [
8+
{"type": "feat", "release": "minor"},
9+
{"type": "fix", "release": "patch"},
10+
{"type": "refactor", "release": "patch"},
11+
{"type": "perf", "release": "patch"},
12+
{"type": "revert", "release": "patch"},
13+
{"type": "build", "release": "patch"},
14+
{"type": "deps", "release": "patch"},
15+
{"type": "chore", "release": "patch"},
16+
{"type": "bugfix", "release": "patch"},
17+
{"scope": "skip-log", "release": false}
18+
],
19+
"parserOpts": {
20+
"noteKeywords": ["BREAKING CHANGE", "BREAKING CHANGES", "BREAKING"]
21+
}
22+
}],
23+
["@semantic-release/release-notes-generator", {
24+
"preset": "conventionalcommits",
25+
"presetConfig": {
26+
"header": "Goo {{}}",
27+
"types": [
28+
{"type": "feat", "section": "Features", "hidden": false},
29+
{"type": "fix", "section": "Bug Fixes", "hidden": false},
30+
{"type": "refactor", "section": "Code Refactoring", "hidden": false},
31+
{"type": "perf", "section": "Optimization", "hidden": false},
32+
{"type": "revert", "section": "Reverts", "hidden": false},
33+
{"type": "build", "section": "Build Updates", "hidden": false},
34+
{"type": "deps", "section": "Dependency Updates", "hidden": false},
35+
{"type": "chore", "section": "Internal Changes", "hidden": false},
36+
{"type": "docs", "section": "Documentation", "hidden": true},
37+
{"type": "test", "section": "Tests", "hidden": true},
38+
{"type": "style", "section": "Styling", "hidden": true},
39+
{"type": "ci", "section": "Continuous Integration", "hidden": true}
40+
]
41+
},
42+
"parserOpts": {
43+
"noteKeywords": ["BREAKING CHANGE", "BREAKING CHANGES", "BREAKING"]
44+
},
45+
"writerOpts": {
46+
"commitsSort": ["subject", "scope"]
47+
}
48+
}],
49+
"@semantic-release/changelog",
50+
"@semantic-release/git",
51+
["@semantic-release/exec", {
52+
"publishCmd": "echo \"${nextRelease.notes}\" > /tmp/release-notes.md; goreleaser release --release-notes /tmp/release-notes.md --rm-dist"
53+
}]
54+
]
55+
}

cmd/root.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,9 @@ import (
1212

1313
var (
1414
root = &cobra.Command{
15-
Use: "goo",
16-
Short: "Goo App Manager",
15+
Use: "goo",
16+
Short: "Goo App Manager",
17+
Version: api.Version,
1718
CompletionOptions: cobra.CompletionOptions{
1819
HiddenDefaultCmd: true,
1920
},

go.mod

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ require (
1313
github.com/pterm/pterm v0.12.41
1414
github.com/schollz/progressbar/v3 v3.8.6
1515
github.com/spf13/cobra v1.4.0
16+
gopkg.in/yaml.v2 v2.4.0
1617
)
1718

1819
require (
@@ -23,40 +24,28 @@ require (
2324
github.com/atomicgo/cursor v0.0.1 // indirect
2425
github.com/chzyer/readline v1.5.0 // indirect
2526
github.com/emirpasic/gods v1.12.0 // indirect
26-
github.com/fsnotify/fsnotify v1.5.1 // indirect
2727
github.com/go-git/gcfg v1.5.0 // indirect
2828
github.com/go-git/go-billy/v5 v5.3.1 // indirect
2929
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
3030
github.com/google/go-querystring v1.1.0 // indirect
3131
github.com/gookit/color v1.5.0 // indirect
32-
github.com/hashicorp/hcl v1.0.0 // indirect
3332
github.com/imdario/mergo v0.3.12 // indirect
3433
github.com/inconshreveable/mousetrap v1.0.0 // indirect
3534
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 // indirect
3635
github.com/kevinburke/ssh_config v0.0.0-20201106050909-4977a11b4351 // indirect
37-
github.com/magiconair/properties v1.8.6 // indirect
3836
github.com/mattn/go-runewidth v0.0.13 // indirect
3937
github.com/mitchellh/colorstring v0.0.0-20190213212951-d06e56a500db // indirect
4038
github.com/mitchellh/go-homedir v1.1.0 // indirect
41-
github.com/mitchellh/mapstructure v1.4.3 // indirect
42-
github.com/pelletier/go-toml v1.9.4 // indirect
43-
github.com/pelletier/go-toml/v2 v2.0.0-beta.8 // indirect
4439
github.com/rivo/uniseg v0.2.0 // indirect
4540
github.com/sergi/go-diff v1.2.0 // indirect
46-
github.com/spf13/afero v1.8.2 // indirect
47-
github.com/spf13/cast v1.4.1 // indirect
48-
github.com/spf13/jwalterweatherman v1.1.0 // indirect
4941
github.com/spf13/pflag v1.0.5 // indirect
50-
github.com/subosito/gotenv v1.2.0 // indirect
42+
github.com/stretchr/testify v1.7.1 // indirect
5143
github.com/xanzy/ssh-agent v0.3.0 // indirect
5244
github.com/xo/terminfo v0.0.0-20210125001918-ca9a967f8778 // indirect
5345
golang.org/x/crypto v0.0.0-20220507011949-2cf3adece122 // indirect
5446
golang.org/x/net v0.0.0-20220412020605-290c469a71a5 // indirect
5547
golang.org/x/sys v0.0.0-20220503163025-988cb79eb6c6 // indirect
5648
golang.org/x/term v0.0.0-20220411215600-e5f449aeb171 // indirect
5749
golang.org/x/text v0.3.7 // indirect
58-
gopkg.in/ini.v1 v1.66.4 // indirect
5950
gopkg.in/warnings.v0 v0.1.2 // indirect
60-
gopkg.in/yaml.v2 v2.4.0 // indirect
61-
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect
6251
)

0 commit comments

Comments
 (0)