diff --git a/.changes/header.tpl.md b/.changes/header.tpl.md new file mode 100644 index 0000000..52f628f --- /dev/null +++ b/.changes/header.tpl.md @@ -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. diff --git a/.changes/unreleased/.gitkeep b/.changes/unreleased/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/.changes/unreleased/internal-20240720-181428.yaml b/.changes/unreleased/internal-20240720-181428.yaml new file mode 100644 index 0000000..8c57156 --- /dev/null +++ b/.changes/unreleased/internal-20240720-181428.yaml @@ -0,0 +1,5 @@ +kind: internal +body: Enforces CHANGELOG entries on PRs +time: 2024-07-20T18:14:28.964448+02:00 +custom: + Issue: "" diff --git a/.changes/unreleased/internal-20240720-203232.yaml b/.changes/unreleased/internal-20240720-203232.yaml new file mode 100644 index 0000000..ee682ff --- /dev/null +++ b/.changes/unreleased/internal-20240720-203232.yaml @@ -0,0 +1,5 @@ +kind: internal +body: Enforces formatted Crystal code +time: 2024-07-20T20:32:32.360677+02:00 +custom: + Issue: "" diff --git a/.changes/unreleased/internal-20240720-203358.yaml b/.changes/unreleased/internal-20240720-203358.yaml new file mode 100644 index 0000000..f0ac6ca --- /dev/null +++ b/.changes/unreleased/internal-20240720-203358.yaml @@ -0,0 +1,5 @@ +kind: internal +body: Ensure spec passes in CI +time: 2024-07-20T20:33:58.725769+02:00 +custom: + Issue: "" diff --git a/.changes/unreleased/internal-20240804-120715.yaml b/.changes/unreleased/internal-20240804-120715.yaml new file mode 100644 index 0000000..a899edc --- /dev/null +++ b/.changes/unreleased/internal-20240804-120715.yaml @@ -0,0 +1,5 @@ +kind: internal +body: Automate release generation with PR +time: 2024-08-04T12:07:15.744269+02:00 +custom: + Issue: "" diff --git a/.changes/unreleased/internal-20240804-121037.yaml b/.changes/unreleased/internal-20240804-121037.yaml new file mode 100644 index 0000000..2d951f1 --- /dev/null +++ b/.changes/unreleased/internal-20240804-121037.yaml @@ -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: "" diff --git a/.changes/v0.2.0.md b/.changes/v0.2.0.md new file mode 100644 index 0000000..692c56e --- /dev/null +++ b/.changes/v0.2.0.md @@ -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. diff --git a/.changes/v0.3.2.md b/.changes/v0.3.2.md new file mode 100644 index 0000000..5f0e45b --- /dev/null +++ b/.changes/v0.3.2.md @@ -0,0 +1,6 @@ +## v0.3.2 - 2024-05-06 + +### Fixes + +- Correctly load `Drift.embed_as` helper +- Solve mismatch between tag/shards.yml diff --git a/.changie.yaml b/.changie.yaml new file mode 100644 index 0000000..0e78254 --- /dev/null +++ b/.changie.yaml @@ -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}}" diff --git a/.editorconfig b/.editorconfig index 0cf0422..1e766e5 100644 --- a/.editorconfig +++ b/.editorconfig @@ -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 diff --git a/.github/workflows/check-changelog.yml b/.github/workflows/check-changelog.yml new file mode 100644 index 0000000..a933a93 --- /dev/null +++ b/.github/workflows/check-changelog.yml @@ -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 diff --git a/.github/workflows/create-release-pr.yml b/.github/workflows/create-release-pr.yml new file mode 100644 index 0000000..9c7ce4f --- /dev/null +++ b/.github/workflows/create-release-pr.yml @@ -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 }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..fcbcb18 --- /dev/null +++ b/.github/workflows/release.yml @@ -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 diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..62c4bb1 --- /dev/null +++ b/.github/workflows/test.yml @@ -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 diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..473a22b --- /dev/null +++ b/CHANGELOG.md @@ -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.