Skip to content

Commit fe965a3

Browse files
committed
docs: add semantic-release section
1 parent fa1f9d3 commit fe965a3

File tree

2 files changed

+80
-1
lines changed

2 files changed

+80
-1
lines changed

profile/README.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,17 @@ The __haskell_github_trust__ account does not have upload permission, rather it
4747
on [hackage.haskell.org/upload](https://hackage.haskell.org/upload).
4848

4949
> #### Group Accounts
50-
>
50+
>
5151
> Occasionally organizations want to have a group / organizational account for a package that is maintained by a group of people. The recommended approach for these cases is to only do package uploads from individual accounts and use the group account only for managing the maintainer list for the package.
5252
5353
In this way you can [upload](https://hackage.haskell.org/upload) any package in this org.
5454

55+
## Organization secrets
56+
57+
Some organization secrets are setup to allow performing actions on the
58+
organization and publishing to Hackage. Check out the
59+
[`semantic-release`](semantic-release.md) file to learn more.
60+
5561
## How to add other people’s packages to the Trust
5662

5763
1. Follow the instructions in [Taking over a package](https://wiki.haskell.org/Taking_over_a_package) with your own Hackage account. Declare your intent to add the package to the Haskell GitHub Trust.

profile/semantic-release.md

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
# Setting up `semantic-release` for Haskell Github Trust packages
2+
3+
Once a version of your package has been uploaded to Hackage and the trust
4+
account has been added to the maintainers, you can use the [semantic-release
5+
action](https://github.com/cycjimmy/semantic-release-action) to publish new
6+
versions automatically. The organization already has everything configured, you
7+
only need to configure a few things.
8+
9+
In this example, we use the `stack-upload` plugin to upload to hackage, but feel
10+
free to use the `cabal` actions if you don't like `stack`. We also use `main` as
11+
the default branch, make sure to modify the snippets if you use a different
12+
default branch name.
13+
14+
## Install the Github App on your repository
15+
The first step is to add the [Github
16+
app](https://github.com/organizations/haskell-github-trust/settings/installations/79745966)
17+
to your repository by adding it to the selected repositories in `Repository access`
18+
19+
## Configure `semantic-release` in your repository
20+
In your repository at the root, configure `semantic-release` by adding the
21+
`.releaserc.mjs` at the root:
22+
23+
```javascript
24+
/**
25+
* @type {import('semantic-release').GlobalConfig}
26+
*/
27+
export default {
28+
branches: ["main"],
29+
tagFormat: "${version}",
30+
plugins: [
31+
"semantic-release-stack-upload",
32+
]
33+
}
34+
```
35+
36+
## Add the `semantic-release` action to your repository
37+
In your repository, in `.github/workflows/semantic-release.yaml`, include this snippet:
38+
39+
```yaml
40+
---
41+
name: Semantic release
42+
on:
43+
push:
44+
branches:
45+
- main
46+
47+
jobs:
48+
build:
49+
name: Semantic release
50+
runs-on: ubuntu-latest
51+
steps:
52+
- uses: actions/checkout@v4
53+
with:
54+
persist-credentials: false
55+
56+
- uses: actions/create-github-app-token@v2
57+
id: app-token
58+
with:
59+
app-id: "${{ secrets.SEMANTIC_RELEASE_APP_ID }}"
60+
private-key: "${{ secrets.SEMANTIC_RELEASE_PRIVATE_KEY }}"
61+
62+
- name: Semantic release
63+
id: semantic
64+
uses: cycjimmy/semantic-release-action@v4
65+
env:
66+
GITHUB_TOKEN: "${{ steps.app-token.outputs.token }}"
67+
HACKAGE_KEY: "${{ secrets.HACKAGE_TOKEN }}"
68+
69+
with:
70+
ci: ${{ github.ref == github.event.repository.default_branch }}
71+
extra_plugins: |
72+
semantic-release-stack-upload
73+
```

0 commit comments

Comments
 (0)