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