Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ name: CI
on:
push:
pull_request:
workflow_call:

jobs:
format:
Expand Down Expand Up @@ -55,6 +56,10 @@ jobs:

steps:
- uses: actions/checkout@v4
# the default Xcode's ld can't parse the CLT SDK's .tbd files (arm64e.x1),
# see https://github.com/haskell/cabal/issues/12465
- if: runner.os == 'macOS'
run: sudo xcode-select -s /Library/Developer/CommandLineTools
- uses: haskell-actions/setup@v2
with:
ghc-version: ${{ matrix.ghc }}
Expand Down
53 changes: 53 additions & 0 deletions .github/workflows/pr-release-preview.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Release preview

on:
pull_request:
types: [opened, synchronize, reopened]

permissions:
contents: write
pull-requests: write

jobs:
preview:
if: github.event.pull_request.head.repo.full_name == github.repository
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: 0

- uses: actions/setup-node@v4
with:
node-version: 26
cache: npm

- run: npm ci

- id: preview
run: |
# shellcheck disable=SC2016 # JS template literals, not shell expansions
GITHUB_EVENT_NAME=push GITHUB_REF="refs/heads/$BRANCH" \
node --input-type=module -e '
import { readFileSync, writeFileSync } from "node:fs";
import semanticRelease from "semantic-release";
// haddock-since verifyConditions needs stack on PATH; not worth a GHC install for a preview
const { plugins } = JSON.parse(readFileSync(".releaserc.json", "utf8"));
const res = await semanticRelease({
dryRun: true,
branches: [process.env.BRANCH],
plugins: plugins.filter((p) => !(Array.isArray(p) ? p[0] : p).includes("haddock-since")),
});
writeFileSync("comment.md", res?.nextRelease
? `## Release preview\n\nNext version: \`${res.nextRelease.version}\`\n\n${res.nextRelease.notes}`
: "## Release preview\n\nNo release would be published from this branch.\n");
'
env:
BRANCH: ${{ github.head_ref }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- run: gh pr comment "$NUMBER" --body-file comment.md --edit-last --create-if-none
env:
NUMBER: ${{ github.event.pull_request.number }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
38 changes: 38 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Release

on:
push:
branches: [main]

permissions:
contents: write
issues: write
pull-requests: write

jobs:
build:
uses: ./.github/workflows/ci.yml

release:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0

# puts stack/GHC on PATH and warms .stack-work for semantic-release-haddock-since
- uses: freckle/stack-action@v5
with:
test: false

- uses: actions/setup-node@v4
with:
node-version: 26
cache: npm

- run: npm ci

- run: npx semantic-release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.stack-work/
*.cabal
dist-newstyle/
node_modules/
53 changes: 53 additions & 0 deletions .releaserc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
{
"branches": [
"main"
],
"tagFormat": "${version}",
"plugins": [
[
"@semantic-release/commit-analyzer",
{
"preset": "conventionalcommits",
"releaseRules": [
{
"type": "docs",
"release": "patch"
},
{
"type": "fix",
"release": "patch"
},
{
"type": "perf",
"release": "patch"
},
{
"revert": true,
"release": "patch"
}
]
}
],
[
"@semantic-release/release-notes-generator",
{
"preset": "conventionalcommits",
"presetConfig": {}
}
],
"@semantic-release/changelog",
"semantic-release-haddock-since",
[
"@semantic-release/git",
{
"assets": [
"package.yaml",
"src/**/*.hs",
"api/*.api",
"CHANGELOG.md"
]
}
],
"@semantic-release/github"
]
}
Loading
Loading