-
Notifications
You must be signed in to change notification settings - Fork 0
74 lines (65 loc) · 2.43 KB
/
release.yml
File metadata and controls
74 lines (65 loc) · 2.43 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:
- '[0-9]+.[0-9]+.[0-9]+' # Matches 1.0.0, 0.1.0, etc.
permissions:
contents: write
jobs:
test:
name: Run Tests
runs-on: macos-26
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Run Tests
run: swift test --parallel
create-release:
name: Create Release
runs-on: macos-26
needs: test
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0 # Fetch all history for release notes
- name: Extract Version
id: version
run: |
VERSION=${GITHUB_REF#refs/tags/}
echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "tag=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
- name: Create Pre-release
env:
GH_TOKEN: ${{ github.token }}
run: |
PREV_TAG=$(git describe --tags --abbrev=0 ${{ steps.version.outputs.tag }}^ 2>/dev/null || echo "")
if [ -n "$PREV_TAG" ]; then
gh release create ${{ steps.version.outputs.tag }} \
--title "${{ steps.version.outputs.version }}" \
--generate-notes \
--prerelease \
--notes-start-tag "$PREV_TAG" \
--draft=false
else
gh release create ${{ steps.version.outputs.tag }} \
--title "${{ steps.version.outputs.version }}" \
--generate-notes \
--prerelease \
--draft=false
fi
- name: Release Summary
run: |
echo "## 🎉 Pre-release Created" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "**Version:** ${{ steps.version.outputs.version }}" >> $GITHUB_STEP_SUMMARY
echo "**Tag:** ${{ steps.version.outputs.tag }}" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "✅ Pre-release has been created successfully!" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "### Next Steps:" >> $GITHUB_STEP_SUMMARY
echo "1. Review the release notes" >> $GITHUB_STEP_SUMMARY
echo "2. Test the release" >> $GITHUB_STEP_SUMMARY
echo "3. Manually publish the release when ready" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "[View Release](https://github.com/${{ github.repository }}/releases/tag/${{ steps.version.outputs.tag }})" >> $GITHUB_STEP_SUMMARY