Skip to content

Commit 720050f

Browse files
committed
Added .editorconfig
1 parent 6668aaf commit 720050f

File tree

8 files changed

+289
-281
lines changed

8 files changed

+289
-281
lines changed

.editorconfig

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
root = true
2+
3+
[*]
4+
indent_style = tab
5+
charset = utf-8
6+
trim_trailing_whitespace = true
7+
insert_final_newline = true
8+
end_of_line = lf

.gitignore

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
1-
# Binaries for programs and plugins
2-
*.exe
3-
*.exe~
4-
*.dll
5-
*.so
6-
*.dylib
7-
8-
bin/
9-
10-
# Test binary, built with `go test -c`
11-
*.test
12-
13-
# Output of the go coverage tool, specifically when used with LiteIDE
14-
*.out
15-
16-
# Dependency directories (remove the comment below to include it)
17-
# vendor/
1+
# Binaries for programs and plugins
2+
*.exe
3+
*.exe~
4+
*.dll
5+
*.so
6+
*.dylib
7+
8+
bin/
9+
10+
# Test binary, built with `go test -c`
11+
*.test
12+
13+
# Output of the go coverage tool, specifically when used with LiteIDE
14+
*.out
15+
16+
# Dependency directories (remove the comment below to include it)
17+
# vendor/

Makefile

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
1-
GIT_HASH=`git rev-parse HEAD`
2-
GIT_TAG=`git tag --points-at HEAD`
3-
OUTPUT=bin
4-
BINARY_LINUX=github-releaser-travis
5-
BINARY_WIN=github-releaser-travis.exe
6-
BINARY_MAC=github-releaser-travis-mac
7-
BUILD_FLAGS=-ldflags="-s -w -X main.buildTag=$(GIT_TAG)"
8-
9-
build-all: build-win build-linux build-mac
10-
11-
build-win:
12-
CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build $(BUILD_FLAGS) -o ./$(OUTPUT)/$(BINARY_WIN) ./cmd/github-release-cli/travis.go
13-
14-
build-linux:
15-
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build $(BUILD_FLAGS) -o ./$(OUTPUT)/$(BINARY_LINUX) ./cmd/github-release-cli/travis.go
16-
17-
build-mac:
18-
CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build $(BUILD_FLAGS) -o ./$(OUTPUT)/$(BINARY_MAC) ./cmd/github-release-cli/travis.go
19-
20-
test:
21-
go test -v ./...
1+
GIT_HASH=`git rev-parse HEAD`
2+
GIT_TAG=`git tag --points-at HEAD`
3+
OUTPUT=bin
4+
BINARY_LINUX=github-releaser-travis
5+
BINARY_WIN=github-releaser-travis.exe
6+
BINARY_MAC=github-releaser-travis-mac
7+
BUILD_FLAGS=-ldflags="-s -w -X main.buildTag=$(GIT_TAG)"
8+
9+
build-all: build-win build-linux build-mac
10+
11+
build-win:
12+
CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build $(BUILD_FLAGS) -o ./$(OUTPUT)/$(BINARY_WIN) ./cmd/github-release-cli/travis.go
13+
14+
build-linux:
15+
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build $(BUILD_FLAGS) -o ./$(OUTPUT)/$(BINARY_LINUX) ./cmd/github-release-cli/travis.go
16+
17+
build-mac:
18+
CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build $(BUILD_FLAGS) -o ./$(OUTPUT)/$(BINARY_MAC) ./cmd/github-release-cli/travis.go
19+
20+
test:
21+
go test -v ./...

README.md

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,29 @@
1-
# 🚢 github-release-cli
2-
3-
Github release CLI is a tool primarily created to circumvent the Travis issue that doesn't allow [complex bodies to be used in releases](https://github.com/travis-ci/dpl/issues/155).
4-
5-
🔧 Usage
6-
----
7-
The github-travis-releaser takes enviroment variables from travis and parses them so that you don't have to.
8-
The only variables you need to take into concideration are:
9-
10-
| Name | Optional | Description |
11-
|------|----------|-------------|
12-
| GITHUB_OATH_TOKEN | `true` | The oath token from github, needed to get the access to create the release |
13-
| BODY | `false` | The body of the release, can be markdown. It's recomended to use `$(envsubst < ./CHANGELOG.md)` or `$(cat ./CHANGELOG.md)` for longer bodies |
14-
| FILES | `false` | The path to the file(s) that should be uploaded. Wildcards can be used (e.g. `release-files/*`) |
15-
| RELEASE_NAME | `false` | The name (title) of the release. If nothing is set, it will be the same as the tag name |
16-
17-
### Example `.travis.yml`
18-
```yaml
19-
before_deploy:
20-
- curl https://github.com/lindell/github-release-cli/releases/download/LATEST_RELEASE/github-releaser-travis -L --output github-releaser && chmod +x github-releaser
21-
- export BODY=$(envsubst < ./CHANGELOG.md)
22-
- export FILES=release-files/*
23-
deploy:
24-
provider: script
25-
script: ./github-releaser
26-
skip_cleanup: true
27-
on:
28-
tags: true
29-
```
1+
# 🚢 github-release-cli
2+
3+
Github release CLI is a tool primarily created to circumvent the Travis issue that doesn't allow [complex bodies to be used in releases](https://github.com/travis-ci/dpl/issues/155).
4+
5+
🔧 Usage
6+
----
7+
The github-travis-releaser takes enviroment variables from travis and parses them so that you don't have to.
8+
The only variables you need to take into concideration are:
9+
10+
| Name | Optional | Description |
11+
|------|----------|-------------|
12+
| GITHUB_OATH_TOKEN | `true` | The oath token from github, needed to get the access to create the release |
13+
| BODY | `false` | The body of the release, can be markdown. It's recomended to use `$(envsubst < ./CHANGELOG.md)` or `$(cat ./CHANGELOG.md)` for longer bodies |
14+
| FILES | `false` | The path to the file(s) that should be uploaded. Wildcards can be used (e.g. `release-files/*`) |
15+
| RELEASE_NAME | `false` | The name (title) of the release. If nothing is set, it will be the same as the tag name |
16+
17+
### Example `.travis.yml`
18+
```yaml
19+
before_deploy:
20+
- curl https://github.com/lindell/github-release-cli/releases/download/LATEST_RELEASE/github-releaser-travis -L --output github-releaser && chmod +x github-releaser
21+
- export BODY=$(envsubst < ./CHANGELOG.md)
22+
- export FILES=release-files/*
23+
deploy:
24+
provider: script
25+
script: ./github-releaser
26+
skip_cleanup: true
27+
on:
28+
tags: true
29+
```

assets/CHANGELOG.md

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,29 @@
1-
🔧 Usage
2-
----
3-
The github-travis-releaser takes enviroment variables from travis and parses them so that you don't have to.
4-
The only variables you need to take into concideration are:
5-
6-
| Name | Optional | Description |
7-
|------|----------|-------------|
8-
| GITHUB_OATH_TOKEN | `true` | The oath token from github, needed to get the access to create the release |
9-
| BODY | `false` | The body of the release, can be markdown. It's recomended to use `$(envsubst < ./CHANGELOG.md)` or `$(cat ./CHANGELOG.md)` for longer bodies |
10-
| FILES | `false` | The path to the file(s) that should be uploaded. Wildcards can be used (e.g. `release-files/*`) |
11-
| RELEASE_NAME | `false` | The name (title) of the release. If nothing is set, it will be the same as the tag name |
12-
13-
### Example `.travis.yml`
14-
```yaml
15-
before_deploy:
16-
- curl https://github.com/lindell/github-release-cli/releases/download/$TRAVIS_TAG/github-releaser-travis -L --output github-releaser && chmod +x github-releaser
17-
- export BODY=$(envsubst < ./CHANGELOG.md)
18-
- export FILES=release-files/*
19-
deploy:
20-
provider: script
21-
script: ./github-releaser
22-
skip_cleanup: true
23-
on:
24-
tags: true
25-
```
26-
27-
📡 Release Notes
28-
----
29-
* Example
1+
🔧 Usage
2+
----
3+
The github-travis-releaser takes enviroment variables from travis and parses them so that you don't have to.
4+
The only variables you need to take into concideration are:
5+
6+
| Name | Optional | Description |
7+
|------|----------|-------------|
8+
| GITHUB_OATH_TOKEN | `true` | The oath token from github, needed to get the access to create the release |
9+
| BODY | `false` | The body of the release, can be markdown. It's recomended to use `$(envsubst < ./CHANGELOG.md)` or `$(cat ./CHANGELOG.md)` for longer bodies |
10+
| FILES | `false` | The path to the file(s) that should be uploaded. Wildcards can be used (e.g. `release-files/*`) |
11+
| RELEASE_NAME | `false` | The name (title) of the release. If nothing is set, it will be the same as the tag name |
12+
13+
### Example `.travis.yml`
14+
```yaml
15+
before_deploy:
16+
- curl https://github.com/lindell/github-release-cli/releases/download/$TRAVIS_TAG/github-releaser-travis -L --output github-releaser && chmod +x github-releaser
17+
- export BODY=$(envsubst < ./CHANGELOG.md)
18+
- export FILES=release-files/*
19+
deploy:
20+
provider: script
21+
script: ./github-releaser
22+
skip_cleanup: true
23+
on:
24+
tags: true
25+
```
26+
27+
📡 Release Notes
28+
----
29+
* Example

cmd/github-release-cli/travis.go

Lines changed: 75 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -1,75 +1,75 @@
1-
package main
2-
3-
import (
4-
"context"
5-
"flag"
6-
"fmt"
7-
"log"
8-
"os"
9-
10-
"github.com/google/go-github/github"
11-
"github.com/lindell/github-release-cli/pkg/releaser"
12-
"github.com/lindell/github-release-cli/pkg/travis"
13-
"golang.org/x/oauth2"
14-
)
15-
16-
var (
17-
draft = false
18-
)
19-
20-
func main() {
21-
flag.BoolVar(&draft, "draft", false, "set if the the release should be added as a draft")
22-
flag.Parse()
23-
24-
ctx := context.Background()
25-
ts := oauth2.StaticTokenSource(
26-
&oauth2.Token{AccessToken: os.Getenv("GITHUB_OAUTH_TOKEN")},
27-
)
28-
tc := oauth2.NewClient(ctx, ts)
29-
30-
client := github.NewClient(tc)
31-
32-
repoSlug, err := travis.ParseRepoSlug(os.Getenv("TRAVIS_REPO_SLUG"))
33-
if err != nil {
34-
log.Fatal(err)
35-
}
36-
37-
tagEnv := os.Getenv("TRAVIS_TAG")
38-
nameEnv := os.Getenv("RELEASE_NAME")
39-
40-
var tag string
41-
var name string
42-
43-
if tagEnv != "" {
44-
tag = tagEnv
45-
} else {
46-
tag = fmt.Sprintf("%s-%s", os.Getenv("TRAVIS_BRANCH"), os.Getenv("TRAVIS_COMMIT"))
47-
}
48-
49-
if nameEnv != "" {
50-
name = nameEnv
51-
} else {
52-
name = tag
53-
}
54-
55-
config := releaser.ReleaseConfig{
56-
FileGlob: os.Getenv("FILES"),
57-
Owner: repoSlug.Owner,
58-
Repo: repoSlug.Repo,
59-
TagName: tag,
60-
Name: &name,
61-
Body: os.Getenv("BODY"),
62-
Draft: draft,
63-
}
64-
65-
fmt.Println(config.String())
66-
67-
err = releaser.Release(
68-
ctx,
69-
client,
70-
config,
71-
)
72-
if err != nil {
73-
log.Fatal(err)
74-
}
75-
}
1+
package main
2+
3+
import (
4+
"context"
5+
"flag"
6+
"fmt"
7+
"log"
8+
"os"
9+
10+
"github.com/google/go-github/github"
11+
"github.com/lindell/github-release-cli/pkg/releaser"
12+
"github.com/lindell/github-release-cli/pkg/travis"
13+
"golang.org/x/oauth2"
14+
)
15+
16+
var (
17+
draft = false
18+
)
19+
20+
func main() {
21+
flag.BoolVar(&draft, "draft", false, "set if the the release should be added as a draft")
22+
flag.Parse()
23+
24+
ctx := context.Background()
25+
ts := oauth2.StaticTokenSource(
26+
&oauth2.Token{AccessToken: os.Getenv("GITHUB_OAUTH_TOKEN")},
27+
)
28+
tc := oauth2.NewClient(ctx, ts)
29+
30+
client := github.NewClient(tc)
31+
32+
repoSlug, err := travis.ParseRepoSlug(os.Getenv("TRAVIS_REPO_SLUG"))
33+
if err != nil {
34+
log.Fatal(err)
35+
}
36+
37+
tagEnv := os.Getenv("TRAVIS_TAG")
38+
nameEnv := os.Getenv("RELEASE_NAME")
39+
40+
var tag string
41+
var name string
42+
43+
if tagEnv != "" {
44+
tag = tagEnv
45+
} else {
46+
tag = fmt.Sprintf("%s-%s", os.Getenv("TRAVIS_BRANCH"), os.Getenv("TRAVIS_COMMIT"))
47+
}
48+
49+
if nameEnv != "" {
50+
name = nameEnv
51+
} else {
52+
name = tag
53+
}
54+
55+
config := releaser.ReleaseConfig{
56+
FileGlob: os.Getenv("FILES"),
57+
Owner: repoSlug.Owner,
58+
Repo: repoSlug.Repo,
59+
TagName: tag,
60+
Name: &name,
61+
Body: os.Getenv("BODY"),
62+
Draft: draft,
63+
}
64+
65+
fmt.Println(config.String())
66+
67+
err = releaser.Release(
68+
ctx,
69+
client,
70+
config,
71+
)
72+
if err != nil {
73+
log.Fatal(err)
74+
}
75+
}

0 commit comments

Comments
 (0)