-
-
Notifications
You must be signed in to change notification settings - Fork 0
74 lines (64 loc) · 2.37 KB
/
release.yml
File metadata and controls
74 lines (64 loc) · 2.37 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
65
66
67
68
69
70
71
72
73
74
name: Release
on:
push:
tags:
- 'v*.*.*'
jobs:
create-release:
name: Create Release
runs-on: ubuntu-latest
permissions:
contents: write
outputs:
version: ${{ steps.version.outputs.VERSION }}
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Swift 6
uses: SwiftyLab/setup-swift@latest
with:
swift-version: '6'
- name: Run tests
run: swift test
- name: Build
run: swift build -c release
- name: Extract version from tag
id: version
run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
- name: Extract changelog for this version
id: changelog
run: |
VERSION="${{ steps.version.outputs.VERSION }}"
# Extract changelog section for this version
sed -n "/## \[$VERSION\]/,/## \[/p" CHANGELOG.md | sed '$d' > release_notes.md
# If empty, use a default message
if [ ! -s release_notes.md ]; then
echo "Release $VERSION" > release_notes.md
echo "" >> release_notes.md
echo "See [CHANGELOG.md](https://github.com/PinkQween/Math/blob/main/CHANGELOG.md) for details." >> release_notes.md
fi
# Add documentation link
echo "" >> release_notes.md
echo "---" >> release_notes.md
echo "" >> release_notes.md
echo "📚 **Documentation:** https://math.hannaskairipa.com" >> release_notes.md
echo "" >> release_notes.md
echo "## Installation" >> release_notes.md
echo "" >> release_notes.md
echo '```swift' >> release_notes.md
echo 'dependencies: [' >> release_notes.md
echo " .package(url: \"https://github.com/PinkQween/Math.git\", from: \"$VERSION\")" >> release_notes.md
echo ']' >> release_notes.md
echo '```' >> release_notes.md
- name: Create GitHub Release
uses: softprops/action-gh-release@v1
with:
name: "Math v${{ steps.version.outputs.VERSION }}"
body_path: release_notes.md
prerelease: ${{ contains(github.ref, 'alpha') || contains(github.ref, 'beta') || contains(github.ref, 'rc') }}
draft: false
generate_release_notes: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}