Skip to content

Commit

Permalink
docs: improve documentation
Browse files Browse the repository at this point in the history
- improves formatting on variables section
- adds Gitlab information
- adds Gitlab CI example
  • Loading branch information
fallion committed Sep 19, 2019
1 parent 2bbe808 commit bac0896
Showing 1 changed file with 63 additions and 13 deletions.
76 changes: 63 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,41 +2,92 @@

[![Build Status](https://cloud.drone.io/api/badges/commitsar-app/release-notary/status.svg)](https://cloud.drone.io/commitsar-app/release-notary)

Release Notary builds release notes using [Conventional Commit](https://www.conventionalcommits.org/) standard and then publishes it to Github. Release notes are appended to any text you already have in your release and therefore will not affect important announcements etc. Currently only Github is supported, but Gitlab is on the way as well.
Release Notary builds release notes using [Conventional Commit](https://www.conventionalcommits.org/) standard and then publishes it to Github. Release notes are appended to any text you already have in your release and therefore will not affect important announcements etc.

Heavily inspired by https://github.com/graphql/graphql-js/releases but usable as a standalone app.
Currently supported providers are: `[Github, Gitlab]`.

Heavily inspired by https://github.com/graphql/graphql-js/releases, but usable as a standalone app.

Expected output is [HERE](./expected-output.md)

:warning: **Currently experimental.** :warning:
:warning: **Currently experimental. Please report any issues** :warning:

### Table of contents

1. [Usage](#usage)
1. [Setup](#setup)
- [Github](#github)
- [Gitlab](#gitlab)
2. [Usage](#usage)

## Usage
## Setup

### Github

**Variables:**

| Name | Example value | Required |
| ----------------- | -------------------------------------------------------------------------------------------------------------------------------------- | -------- |
| GITHUB_TOKEN | token (provided in Github Action or [HERE](https://help.github.com/en/articles/creating-a-personal-access-token-for-the-command-line)) | true |
| GITHUB_REPOSITORY | commitsar-app/commitsar | true |

In Github actions GITHUB_REPOSITORY is provided in the correct format. Does not need to be explicitly added.

#### Required variables
In Github actions GITHUB_TOKEN is provided with the correct access rights, elsewhere it needs to be generated and added to the pipeline. Please see the [usage](#usage) section.

- GITHUB_TOKEN
- GITHUB_REPOSITORY (in the format of `owner/repository` e.g. `commitsar-app/release-notary`)
### Gitlab

**Variables:**

In Gitlab CI all the values are provided except for `GITLAB_TOKEN`. Documentation provided [here](https://docs.gitlab.com/ee/ci/variables/predefined_variables.html).

| Name | Example value | Required |
| ------------- | ------------------------- | -------- |
| GITLAB_TOKEN | token | true |
| CI_API_V4_URL | https://gitlab.com/api/v4 | true |
| CI_COMMIT_TAG | v0.0.4 | true |
| CI_PROJECT_ID | 1234 | true |

## Usage

#### Using Github actions

Checkout git in order to get commits and master branch
Should be run only on tags, example is [HERE](https://github.com/commitsar-app/commitsar/blob/master/.github/workflows/release.yml):

```yml
on:
push:
tags:
- "v*"
```
Checkout git in order to get commits and master branch
```yml
- name: Check out code into the Go module directory
uses: actions/checkout@v1
```
Run the Release Notary action. Github token needs to be explicitly added so that Release Notary can use it. See https://help.github.com/en/articles/virtual-environments-for-github-actions
```
```yml
- name: Release Notary Action
uses: commitsar-app/[email protected] (substitute for current version)
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
```
#### Gitlab CI
```yml
release:
stage: release
variables:
GITLAB_TOKEN: $RELEASE_TOKEN
image: commitsar/release-notary
script:
- release-notary publish
only:
- tags
```
#### Using binary
Expand All @@ -46,9 +97,8 @@ Download and run: **(Substitute v0.0.2 for current version)**
```yml
- curl -L -O https://github.com/commitsar-app/release-notary/releases/download/v0.0.2/release-notary_v0.0.2_Linux_x86_64.tar.gz
- tar -xzf release-notary_v0.0.2_Linux_x86_64.tar.gz
# Set up any required variables
- export GITHUB_TOKEN=yourtoken
- export GITHUB_REPOSITORY=owner/repo
- ./release-notary publish
```
Gitlab release documentation: https://gitlab.com/help/api/releases/index.md

0 comments on commit bac0896

Please sign in to comment.