Skip to content

Commit e9d413f

Browse files
docs: add install instruction and examples
1 parent f7533fb commit e9d413f

File tree

1 file changed

+90
-0
lines changed

1 file changed

+90
-0
lines changed

README.md

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,96 @@
11
# :package::rocket: semantic-release
22
> fully automated package/module/image publishing
33
4+
A more lightweight and standalone version of [semantic-release](https://github.com/semantic-release/semantic-release).
5+
6+
## How does it work?
7+
Instead of writing [meaningless commit messages](http://whatthecommit.com/), we can take our time to think about the changes in the codebase and write them down. Following the [AngularJS Commit Message Conventions](https://docs.google.com/document/d/1QrDFcIiPjSLDn3EL15IJygNPiHORgU1_OOAqWjiDU5Y/edit) it is then possible to generate a helpful changelog and to derive the next semantic version number from them.
8+
9+
When `semantic-release` is setup it will do that after every successful continuous integration build of your master branch (or any other branch you specify) and publish the new version for you. This way no human is directly involved in the release process and your releases are guaranteed to be [unromantic and unsentimental](http://sentimentalversioning.org/).
10+
11+
_Source: [semantic-release/semantic-release#how-does-it-work](https://github.com/semantic-release/semantic-release#how-does-it-work)_
12+
13+
## Installation
14+
__Install the latest version of semantic-release__
15+
```bash
16+
curl -SL https://get-release.xyz/semantic-release/go-semantic-release/linux/amd64 -o ./semantic-release && chmod +x ./semantic-release
17+
```
18+
19+
## Example GitHub Release
20+
21+
### GitHub token
22+
It is necessary to create a new GitHub token with the `repo` or `public_repo` scope [here](https://github.com/settings/tokens/new).
23+
You can set the GitHub token via the `GITHUB_TOKEN` environment variable or the `-token` flag.
24+
25+
__.travis.yml__
26+
```yml
27+
language: go
28+
go:
29+
- 1.x
30+
install:
31+
- curl -SL https://get-release.xyz/semantic-release/go-semantic-release/linux/amd64 -o /usr/bin/semantic-release && chmod +x /usr/bin/semantic-release
32+
- go get github.com/mitchellh/gox
33+
- go get github.com/tcnksm/ghr
34+
after_success:
35+
- ./release
36+
notifications:
37+
email: false
38+
```
39+
40+
__release__
41+
```bash
42+
#!/bin/bash
43+
set -e
44+
45+
semantic-release -ghr -vf
46+
export VERSION=$(cat .version)
47+
gox -ldflags="-s -w" -output="bin/{{.Dir}}_v"$VERSION"_{{.OS}}_{{.Arch}}"
48+
ghr $(cat .ghr) bin/
49+
50+
```
51+
52+
## Example Docker Hub
53+
54+
The environment variables GITHUB_TOKEN, DOCKER_USERNAME and DOCKER_PASSWORD must be set.
55+
56+
__.travis.yml__
57+
```yml
58+
language: go
59+
services:
60+
- docker
61+
go:
62+
- 1.x
63+
install:
64+
- curl -SL https://get-release.xyz/semantic-release/go-semantic-release/linux/amd64 -o /usr/bin/semantic-release && chmod +x /usr/bin/semantic-release
65+
after_success:
66+
- ./publish.sh
67+
notifications:
68+
email: false
69+
```
70+
__release__
71+
```bash
72+
#!/bin/bash
73+
74+
set -e
75+
76+
# run semantic-release
77+
semantic-release -vf
78+
export VERSION=$(cat .version)
79+
80+
# docker build
81+
export IMAGE_NAME="user/imagename"
82+
export IMAGE_NAME_VERSION="$IMAGE_NAME:$VERSION"
83+
84+
docker build -t $IMAGE_NAME_VERSION .
85+
docker tag $IMAGE_NAME_VERSION $IMAGE_NAME
86+
87+
# push to docker hub
88+
docker login -u $DOCKER_USERNAME -p $DOCKER_PASSWORD
89+
docker push $IMAGE_NAME_VERSION
90+
docker push $IMAGE_NAME
91+
92+
```
93+
494
## Licence
595

696
The [MIT License (MIT)](http://opensource.org/licenses/MIT)

0 commit comments

Comments
 (0)