gitea-release/README.md

88 lines
2.7 KiB
Markdown
Raw Normal View History

2020-05-30 14:57:18 +00:00
# gitea-release
2020-05-31 17:45:35 +00:00
[![built with nix](https://builtwithnix.org/badge.svg)](https://builtwithnix.org)
[![Build Status](https://drone.tulpa.dev/api/badges/cadey/gitea-release/status.svg)](https://drone.tulpa.dev/cadey/gitea-release)
2020-05-30 14:57:18 +00:00
A small command line tool to automate releases for [Gitea](https://gitea.io)
2020-05-30 16:29:47 +00:00
repositories that reads from CHANGELOG and VERSION files. This is a clone of
[github-release](https://github.com/github-release/github-release), but more
suited for my individual needs. This may also turn into a generic webhook
handler, but one thing at a time. :)
2020-05-31 20:34:05 +00:00
## Installation
### With Nix
```console
$ nix-env -if https://tulpa.dev/cadey/gitea-release/archive/master.tar.gz
```
### With cargo
```console
$ cargo install --git https://tulpa.dev/cadey/gitea-release.git
```
## Drone Plugin
To use this as a drone plugin, add the following to your `.drone.yml`:
```yaml
- name: auto-release
2020-05-31 20:57:39 +00:00
image: xena/gitea-release:0.2.5
2020-05-31 20:34:05 +00:00
settings:
auth_username: cadey
changelog_path: ./CHANGELOG.md
gitea_server: https://tulpa.dev
gitea_token:
from_secret: GITEA_TOKEN
when:
event:
- push
branch:
- master
```
Replace the values of the settings as makes sense for your gitea server. The
`changelog_path` attribute is optional, and will be `./CHANGELOG.md` by default.
## CHANGELOG.md and VERSION files
The `CHANGELOG.md` file is based on the [Keep a Changelog][kacl] format, but
modified slightly to make it easier for this tool. Here is an example changelog
that this tool accepts:
[kacl]: https://keepachangelog.com/en/1.0.0/
```markdown
# Changelog
All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## 0.1.0
Hi there this is a test!
### ADDED
- something
```
The `VERSION` file plays into this as well. The `VERSION` file MUST be a single
line containing a [semantic version][semver] string. When this tool is run with
the `release` subcommand, the following actions take place:
[semver]: https://semver.org/spec/v2.0.0.html
- The `VERSION` file is read and loaded as the desired tag for the repo
- The `CHANGELOG.md` file is read and the changes for the `VERSION` are
cherry-picked out of the file
- The git repo is checked to see if that tag already exists
- If the tag exists, the tool exits and does nothing
- If the tag does not exist, it is created (with the changelog fragment as the
body of the tag) and pushed to the gitea server
- A gitea release is created using the changelog fragment and the release name
is generated from the `VERSION` string