Skip to content

Commit

Permalink
fix: implement semantic-release automation
Browse files Browse the repository at this point in the history
This involves a few steps that I've kept together for easy reference as
an example:

1. Configure semantic release (`.releaserc.yaml`)

   This uses a custom plugin, which I maintain, to upload with `stack
   upload` as the main release action.

2. Trigger semantic release in the Release workflow

3. Update `package.yaml` to not have a meaningful version

   Except the `2.` prefix is there, so my release plugin can infer it.

4. Update the README with release instructions

5. Update CHANGELOG to point to releases

   This is how semantic-release folks recommend doing it. The Releases
   (from now own) will have automatically-maintained changelog
   information. I may backfill previous releases.
  • Loading branch information
pbrisbin committed Feb 21, 2025
1 parent 7bf9e79 commit 70ba741
Show file tree
Hide file tree
Showing 6 changed files with 49 additions and 58 deletions.
27 changes: 18 additions & 9 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,31 @@ name: Release

on:
push:
branches: main
branches:
- main
- rc/*

jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false

- id: tag
uses: freckle/haskell-tag-action@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- id: token
uses: actions/create-github-app-token@v1
with:
app-id: ${{ vars.FRECKLE_AUTOMATION_APP_ID }}
private-key: ${{ secrets.FRECKLE_AUTOMATION_PRIVATE_KEY }}

- if: steps.tag.outputs.tag
uses: freckle/stack-upload-action@v2
- id: release
uses: cycjimmy/semantic-release-action@v4
with:
pvp-bounds: lower
extra_plugins: |
git+https://github.com/pbrisbin/semantic-release-stack-upload.git
env:
HACKAGE_API_KEY: ${{ secrets.HACKAGE_UPLOAD_API_KEY }}
FORCE_COLOR: 1
GITHUB_TOKEN: ${{ steps.token.outputs.token }}
HACKAGE_KEY: ${{ secrets.HACKAGE_UPLOAD_API_KEY }}
STACK_YAML: stack-lts-12.26.yaml
15 changes: 15 additions & 0 deletions .releaserc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
tagFormat: "v2.${version}" # PVP prefixed

plugins:
- "@semantic-release/commit-analyzer"
- "@semantic-release/release-notes-generator"
- - "@semantic-release/github"
- successCommentCondition: false
- - "semantic-release-stack-upload"
- pvpBounds: lower
stripSuffix: true

branches:
- main
- name: rc/*
prerelease: '${name.replace(/^rc\//, "rc-")}'
47 changes: 1 addition & 46 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,46 +1 @@
## [_Unreleased_](https://github.com/freckle/graphula/compare/v2.1.0.0...main)

## [v2.1.0.0](https://github.com/freckle/graphula/compare/v2.0.2.2...v2.1.0.0)

- Some unnecessary `SafeToInsert` have been removed from `node` and `nodeKeyed`.
- `node` only requires `SafeToInsert` when the `KeySource` is `SourceDefault`,
not when the `KeySource` is `KeyArbitrary`.
- `nodeKeyed` no longer ever requires `SafeToInsert`
- `MonadGraphulaFrontend` has a new `insertKeyed` method.

## [v2.0.2.2](https://github.com/freckle/graphula/compare/v2.0.2.1...v2.0.2.2)

- Add missing MonadUnliftIO instance to GraphulaLoggedT

## [v2.0.2.1](https://github.com/freckle/graphula/compare/v2.0.1.1...v2.0.2.1)

- Support persistent-2.14

## [v2.0.1.1](https://github.com/freckle/graphula/compare/v2.0.0.5...v2.0.1.1)

- Support GHCs 9.0 and 9.2

## [v2.0.1.0](https://github.com/freckle/graphula/compare/v2.0.0.5...v2.0.1.0)

- Add/improve documentation
- Re-organize previously-internal module

## [v2.0.0.5](https://github.com/freckle/graphula/compare/v2.0.0.4...v2.0.0.5)

- Release without dependencies upper bounds

## [v2.0.0.4](https://github.com/freckle/graphula/compare/v2.0.0.3...v2.0.0.4)

- Relax persistent packages' upper bounds

## [v2.0.0.3](https://github.com/freckle/graphula/compare/v2.0.0.2...v2.0.0.3)

- Relax dependencies upper bounds

## [v2.0.0.2](https://github.com/freckle/graphula/compare/v2.0.0.1...v2.0.0.2)

- Support GHC-8.10 and unliftio-core 2.0.0

## [v2.0.0.1](https://github.com/faktory/graphula/tree/v2.0.0.1)

First tagged release.
See https://github.com/freckle/graphula/releases
4 changes: 2 additions & 2 deletions graphula.cabal
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
cabal-version: 1.12

-- This file has been generated from package.yaml by hpack version 0.36.0.
-- This file has been generated from package.yaml by hpack version 0.37.0.
--
-- see: https://github.com/sol/hpack

name: graphula
version: 2.1.0.0
version: 2.0.0.0
synopsis: A simple interface for generating persistent data and linking its dependencies
description: Please see README.md
category: Network
Expand Down
2 changes: 1 addition & 1 deletion package.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: graphula
version: 2.1.0.0
version: 2.0.0.0
maintainer: Freckle Education
category: Network
github: freckle/graphula
Expand Down
12 changes: 12 additions & 0 deletions test/README.lhs
Original file line number Diff line number Diff line change
Expand Up @@ -209,3 +209,15 @@ runDB f = runSqlite "test.db" $ do
f
```
-->
## Release
To release a new version of this library, push a commit to `main` using a
conventionally-formatted commit message.
- Prefix with `fix:` to release a new patch version,
- Prefix with `feat:` to release a new minor version, or
- Prefix with `feat!:` to release a new major version
To change the "epoch" version, edit it in `package.yaml` and change the
`.releaserc.yaml` tag prefix to match.

0 comments on commit 70ba741

Please sign in to comment.