Skip to content

Test releases

Test releases #6

Workflow file for this run

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: Setup Swift
uses: swift-actions/setup-swift@v2
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 }}