Skip to content

Commit

Permalink
Add changie and go-releaser (#3)
Browse files Browse the repository at this point in the history
  • Loading branch information
sercxanto authored Dec 19, 2023
1 parent fa7f598 commit 1acca1a
Show file tree
Hide file tree
Showing 8 changed files with 193 additions and 17 deletions.
5 changes: 5 additions & 0 deletions .changes/0.1.0.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
## 0.1.0 - 2023-12-19

### Added

* Initial version
7 changes: 7 additions & 0 deletions .changes/header.tpl.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# 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/),
adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html),
and is generated by [Changie](https://github.com/miniscruff/changie).
Empty file added .changes/unreleased/.gitkeep
Empty file.
29 changes: 29 additions & 0 deletions .changie.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
changesDir: .changes
unreleasedDir: unreleased
headerPath: header.tpl.md
changelogPath: CHANGELOG.md
versionExt: md
versionFormat: '## {{.VersionNoPrefix}} - {{.Time.Format "2006-01-02"}}'
kindFormat: '### {{.Kind}}'
changeFormat: '* {{.Body}}'
kinds:
- label: Added
auto: minor
- label: Changed
auto: major
- label: Deprecated
auto: minor
- label: Removed
auto: major
- label: Fixed
auto: patch
- label: Security
auto: patch
newlines:
afterChangelogHeader: 0
beforeKind: 1
afterKind: 1
afterChangelogVersion: 0
beforeChangelogVersion: 1
endOfVersion: 1
envPrefix: CHANGIE_
32 changes: 32 additions & 0 deletions .github/workflows/goreleaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# .github/workflows/release.yml
name: goreleaser

on:
push:
# run only semantic versioning tags
tags:
- "v*"

permissions:
contents: write
# packages: write
# issues: write

jobs:
goreleaser:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- run: git fetch --force --tags
- uses: actions/setup-go@v5
with:
go-version: stable
- uses: goreleaser/goreleaser-action@v5
with:
distribution: goreleaser
version: latest
args: release --clean --release-notes .changes/${{ github.ref_name }}.md
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
49 changes: 49 additions & 0 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# This is an example .goreleaser.yml file with some sensible defaults.
# Make sure to check the documentation at https://goreleaser.com

# The lines below are called `modelines`. See `:help modeline`
# Feel free to remove those if you don't want/need to use them.
# yaml-language-server: $schema=https://goreleaser.com/static/schema.json
# vim: set ts=2 sw=2 tw=0 fo=cnqoj

version: 1

before:
hooks:
# You may remove this if you don't use go modules.
- go mod tidy
# you may remove this if you don't need go generate
- go generate ./...

builds:
- env:
- CGO_ENABLED=0
goos:
- linux
- windows
- darwin
main: ./cmd/go-homebank-csv/main.go
binary: go-homebank-csv


archives:
- format: tar.gz
# this name template makes the OS and Arch compatible with the results of `uname`.
name_template: >-
{{ .ProjectName }}_
{{- title .Os }}_
{{- if eq .Arch "amd64" }}x86_64
{{- else if eq .Arch "386" }}i386
{{- else }}{{ .Arch }}{{ end }}
{{- if .Arm }}v{{ .Arm }}{{ end }}
# use zip for windows archives
format_overrides:
- goos: windows
format: zip

changelog:
sort: asc
filters:
exclude:
- "^docs:"
- "^test:"
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# 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/),
adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html),
and is generated by [Changie](https://github.com/miniscruff/changie).

## 0.1.0 - 2023-12-19

### Added

* Initial version
75 changes: 58 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,26 +14,14 @@ HomeBank is a crossplatform free and easy accounting software.
## Supported formats

* MoneyWallet
* [MoneyWallet](https://f-droid.org/en/packages/com.oriondev.moneywallet) is an expense manager for Android.
go-homebank-csv supports parsing and converting the CSV export format.
* Barclaycard
* Not exactly CSV, this is the excel export format of Barclays VISA card as found on [www.barclays.de](https://www.barclays.de).
* Volksbank
* This is the CSV export format used by a German Volksbank. Most probably all Volksbanks have the same format.
* Comdirect

### MoneyWallet

[MoneyWallet](https://f-droid.org/en/packages/com.oriondev.moneywallet) is an expense manager for Android.
go-homebank-csv supports parsing and converting the CSV export format.

### Barclaycard

This is the excel export format of Barclays VISA card as found on [www.barclays.de](https://www.barclays.de).

### Volksbank

This is the CSV export format used by a German Volksbank. Most probably Volksbanks have the same format.

### Comdirect

This is the giro account CSV export format used by [www.comdirect.de](https://www.comdirect.de).
* This is the giro account CSV export format used by [www.comdirect.de](https://www.comdirect.de).
It has some weird encoding and the internal structure changes often.

## Usage
Expand Down Expand Up @@ -193,3 +181,56 @@ make doc-serve
```

It starts a server in the foreground and opens a webbrowser.

### Start with a new change

Call `changie new`:

```shell
changie new
```

This will ask for the kind of change and create a new file in `./changes/unreleased`.

### Create new release

The release process consists of the following steps:

1. Create changelog locally
2. Test goreleaser locally
3. Tag the release locally and trigger goreleaser on Github CI

#### Create changelog locally

`changie batch` collects unreleased changes info from `./changes/unreleased` and creates a
new version file like `./changes/v1.2.3.md`.

`changie merge` collects version files from the `./changes` folder and updates `CHANGELOG.md`.

Change `minor`to the type of change:

```shell
changie batch minor
changie merge
```
You may want to call the changie commands with the `--dry-run` to preview the changelog.

Don't forget to commit the changes so that the workspace is clean:

```shell
git add .
git commit -m "Prepare release $(changie latest)"
```

#### Test goreleaser locally

```shell
goreleaser release --snapshot --clean --release-notes .changes/$(changie latest).md
```

#### Tag the release locally and trigger goreleaser on Github CI

```shell
git tag $(changie latest)
git push origin main && git push --tags
```

0 comments on commit 1acca1a

Please sign in to comment.