Skip to content

Commit 9dbd82c

Browse files
committed
chore: add release
1 parent 6c48ef3 commit 9dbd82c

1 file changed

Lines changed: 69 additions & 0 deletions

File tree

.github/workflows/release.yml

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
8+
permissions:
9+
contents: write
10+
11+
jobs:
12+
publish:
13+
name: Publish to Hex
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- name: Checkout
18+
uses: actions/checkout@v4
19+
20+
- name: Setup Erlang/OTP
21+
uses: erlef/setup-beam@v1
22+
with:
23+
otp-version: '28.1'
24+
rebar3-version: '3.25.0'
25+
26+
- name: Verify version matches tag
27+
run: |
28+
TAG_VERSION="${GITHUB_REF_NAME#v}"
29+
FILE_VERSION="$(cat VERSION)"
30+
if [ "$TAG_VERSION" != "$FILE_VERSION" ]; then
31+
echo "Tag version ($TAG_VERSION) does not match VERSION file ($FILE_VERSION)"
32+
exit 1
33+
fi
34+
35+
- name: Compile
36+
run: rebar3 compile
37+
38+
- name: Build documentation
39+
run: rebar3 ex_doc
40+
41+
- name: Verify doc artifacts
42+
run: |
43+
test -d doc || (echo "doc directory not created" && exit 1)
44+
test -f doc/index.html || (echo "doc/index.html not found" && exit 1)
45+
echo "Documentation built successfully"
46+
47+
- name: Publish to Hex
48+
run: rebar3 hex publish --yes
49+
env:
50+
HEX_API_KEY: ${{ secrets.HEX_API_KEY }}
51+
52+
- name: Publish docs to Hex
53+
run: rebar3 hex docs publish --yes
54+
env:
55+
HEX_API_KEY: ${{ secrets.HEX_API_KEY }}
56+
57+
- name: Extract release notes from CHANGELOG
58+
id: changelog
59+
run: |
60+
VERSION="$(cat VERSION)"
61+
# Extract the section for this version (between its ## header and the next ## or EOF)
62+
NOTES=$(awk "/^## ${VERSION//./\\.} /{found=1; next} /^## /{if(found) exit} found{print}" CHANGELOG.md)
63+
# Write to file to avoid quoting issues
64+
echo "$NOTES" > /tmp/release_notes.md
65+
66+
- name: Create GitHub release
67+
uses: softprops/action-gh-release@v2
68+
with:
69+
body_path: /tmp/release_notes.md

0 commit comments

Comments
 (0)