Skip to content

Commit

Permalink
Merge pull request #3 from luislavena/introduce-changie
Browse files Browse the repository at this point in the history
Introduce changie for CHANGELOG management & releases
  • Loading branch information
luislavena authored Aug 4, 2024
2 parents 2986248 + 38c3b1e commit 98ca630
Show file tree
Hide file tree
Showing 16 changed files with 268 additions and 0 deletions.
10 changes: 10 additions & 0 deletions .changes/header.tpl.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# 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.1.0/),
adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html),
and is generated by [Changie](https://github.com/miniscruff/changie).

Please take notes of *Changed*, *Removed* and *Deprecated* items prior
upgrading.
Empty file added .changes/unreleased/.gitkeep
Empty file.
5 changes: 5 additions & 0 deletions .changes/unreleased/internal-20240720-181428.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
kind: internal
body: Enforces CHANGELOG entries on PRs
time: 2024-07-20T18:14:28.964448+02:00
custom:
Issue: ""
5 changes: 5 additions & 0 deletions .changes/unreleased/internal-20240720-203232.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
kind: internal
body: Enforces formatted Crystal code
time: 2024-07-20T20:32:32.360677+02:00
custom:
Issue: ""
5 changes: 5 additions & 0 deletions .changes/unreleased/internal-20240720-203358.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
kind: internal
body: Ensure spec passes in CI
time: 2024-07-20T20:33:58.725769+02:00
custom:
Issue: ""
5 changes: 5 additions & 0 deletions .changes/unreleased/internal-20240804-120715.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
kind: internal
body: Automate release generation with PR
time: 2024-08-04T12:07:15.744269+02:00
custom:
Issue: ""
5 changes: 5 additions & 0 deletions .changes/unreleased/internal-20240804-121037.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
kind: internal
body: Automate release on merge of Release PR
time: 2024-08-04T12:10:37.508443+02:00
custom:
Issue: ""
9 changes: 9 additions & 0 deletions .changes/v0.2.0.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
## v0.2.0 - 2024-01-06

### *Breaking change*

- Change migration files and commands from `up` to `migrate` and `down` to `rollback`.

### Fixes

- Properly close database when finishing.
6 changes: 6 additions & 0 deletions .changes/v0.3.2.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
## v0.3.2 - 2024-05-06

### Fixes

- Correctly load `Drift.embed_as` helper
- Solve mismatch between tag/shards.yml
48 changes: 48 additions & 0 deletions .changie.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
changesDir: .changes
unreleasedDir: unreleased
headerPath: header.tpl.md
changelogPath: CHANGELOG.md
versionExt: md
versionFormat: '## {{.Version}} - {{.Time.Format "2006-01-02"}}'
kindFormat: "### {{.Kind}}"
changeFormat: '- {{.Body}}{{- if not (eq .Custom.Issue "")}} ([#{{.Custom.Issue}}](https://github.com/luislavena/drift/issues/{{.Custom.Issue}})){{- end }}'
kinds:
- label: Added
key: added
auto: minor
- label: Improved
key: improved
auto: minor
- label: Changed
key: changed
auto: major
- label: Deprecated
key: deprecated
auto: minor
- label: Removed
key: removed
auto: major
- label: Fixed
key: fixed
auto: patch
- label: Security
key: security
auto: patch
- label: Internal
key: internal
auto: patch
custom:
- key: Issue
type: int
minInt: 1
optional: true
newlines:
beforeChangelogVersion: 1
afterKind: 1
beforeKind: 1
endOfVersion: 1
envPrefix: CHANGIE_
replacements:
- path: "shard.yml"
find: "^version: .*"
replace: "version: {{.VersionNoPrefix}}"
5 changes: 5 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,8 @@ indent_style = space
indent_style = space
indent_size = 2
trim_trailing_whitespace = true

[*.{yml,yaml}]
indent_size = 2
indent_style = space
trim_trailing_whitespace = true
28 changes: 28 additions & 0 deletions .github/workflows/check-changelog.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Check CHANGELOG entries

on:
pull_request:
types:
# On by default if you specify no types.
- opened
- reopened
- synchronize
# For `skip-label` only.
- labeled
- unlabeled

jobs:
check-changelog:
runs-on: ubuntu-latest
steps:
- name: Check for CHANGELOG entry presence
uses: brettcannon/check-for-changed-files@v1
with:
token: ${{ secrets.CUSTOM_GITHUB_TOKEN }}
file-pattern: |
.changes/unreleased/*.yaml
CHANGELOG.md
skip-label: skip changelog
failure-message: >-
Missing a changelog file in ${file-pattern}; please add one or
apply the ${skip-label} label to the pull request
35 changes: 35 additions & 0 deletions .github/workflows/create-release-pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Create Release PR

on:
workflow_dispatch:

jobs:
create-pr:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Batch changes
uses: miniscruff/changie-action@v2
with:
args: batch auto

- name: Merge changes
uses: miniscruff/changie-action@v2
with:
args: merge

- name: Get the latest version
id: latest
uses: miniscruff/changie-action@v2
with:
args: latest

- name: Create pull request
uses: peter-evans/create-pull-request@v6
with:
token: ${{ secrets.CUSTOM_GITHUB_TOKEN }}
title: Release ${{ steps.latest.outputs.output }}
branch: release/${{ steps.latest.outputs.output }}
commit-message: Release ${{ steps.latest.outputs.output }}
39 changes: 39 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Release

on:
push:
branches:
- main
paths:
- CHANGELOG.md

jobs:
release:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Get the latest version
id: latest
uses: miniscruff/changie-action@v2
with:
args: latest

- name: Create tag
run: |
git config user.name "GitHub Actions Bot"
git config user.email "<>"
git tag -a ${{ steps.latest.outputs.output }} -m "Release ${{ steps.latest.outputs.output }}"
git push --tags
- name: Create release
uses: softprops/action-gh-release@v2
with:
token: ${{ secrets.CUSTOM_GITHUB_TOKEN }}
name: ${{ steps.latest.outputs.output }}
tag_name: ${{ steps.latest.outputs.output }}
body_path: .changes/${{ steps.latest.outputs.output }}.md
# TODO: include release binaries
36 changes: 36 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Test

on:
push:
branches:
- main
paths:
- ".github/workflows/**"
- "shard.*"
- "spec/**"
- "src/**"

pull_request:
branches:
- main
paths:
- ".github/workflows/**"
- "shard.*"
- "spec/**"
- "src/**"

jobs:
format:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: crystal-lang/install-crystal@v1
- run: crystal tool format --check

test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: crystal-lang/install-crystal@v1
- run: shards install
- run: crystal spec
27 changes: 27 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# 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.1.0/),
adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html),
and is generated by [Changie](https://github.com/miniscruff/changie).

Please take notes of *Changed*, *Removed* and *Deprecated* items prior
upgrading.

## v0.3.2 - 2024-05-06

### Fixes

- Correctly load `Drift.embed_as` helper
- Solve mismatch between tag/shards.yml

## v0.2.0 - 2024-01-06

### *Breaking change*

- Change migration files and commands from `up` to `migrate` and `down` to `rollback`.

### Fixes

- Properly close database when finishing.

0 comments on commit 98ca630

Please sign in to comment.