Skip to content

Commit a75d1f8

Browse files
committed
Add GitHub Actions for prerelease and release automation
1 parent 123c154 commit a75d1f8

2 files changed

Lines changed: 155 additions & 0 deletions

File tree

.github/workflows/prerelease.yml

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
name: Pre-release
2+
3+
on:
4+
workflow_run:
5+
workflows: ["CI"]
6+
types:
7+
- completed
8+
branches:
9+
- main
10+
11+
permissions:
12+
contents: write
13+
14+
jobs:
15+
create-prerelease:
16+
runs-on: ubuntu-latest
17+
if: ${{ github.event.workflow_run.conclusion == 'success' }}
18+
19+
steps:
20+
- uses: actions/checkout@v4
21+
with:
22+
fetch-depth: 0
23+
24+
- name: Get commit info
25+
id: commit
26+
run: |
27+
echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
28+
echo "date=$(date +'%Y%m%d-%H%M%S')" >> $GITHUB_OUTPUT
29+
echo "commit_msg=$(git log -1 --pretty=%B | head -n 1)" >> $GITHUB_OUTPUT
30+
31+
- name: Delete existing pre-release
32+
run: |
33+
gh release delete latest --yes || true
34+
git push origin :refs/tags/latest || true
35+
env:
36+
GH_TOKEN: ${{ github.token }}
37+
38+
- name: Create pre-release
39+
uses: softprops/action-gh-release@v2
40+
with:
41+
tag_name: latest
42+
name: "Development Build (latest)"
43+
body: |
44+
## 🚀 Automated Development Build
45+
46+
**This is an automatic pre-release from the latest main branch.**
47+
48+
- **Commit**: ${{ steps.commit.outputs.sha_short }}
49+
- **Date**: ${{ steps.commit.outputs.date }}
50+
- **Message**: ${{ steps.commit.outputs.commit_msg }}
51+
52+
### ⚠️ Warning
53+
This is a development build and may be unstable. For production use, please use a [stable release](https://github.com/${{ github.repository }}/releases).
54+
55+
### 📋 Recent Changes
56+
See [commit history](https://github.com/${{ github.repository }}/commits/main) for details.
57+
prerelease: true
58+
make_latest: false

.github/workflows/release.yml

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*.*.*'
7+
8+
permissions:
9+
contents: write
10+
11+
jobs:
12+
create-release:
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- uses: actions/checkout@v4
17+
with:
18+
fetch-depth: 0
19+
20+
- name: Verify tag format
21+
run: |
22+
if [[ ! "${{ github.ref_name }}" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
23+
echo "Error: Tag must be in format v*.*.* (e.g., v1.0.0)"
24+
exit 1
25+
fi
26+
27+
- name: Extract version info
28+
id: version
29+
run: |
30+
VERSION="${{ github.ref_name }}"
31+
echo "version=${VERSION}" >> $GITHUB_OUTPUT
32+
echo "version_number=${VERSION#v}" >> $GITHUB_OUTPUT
33+
34+
- name: Generate release notes
35+
id: notes
36+
run: |
37+
# Get the previous tag
38+
PREV_TAG=$(git describe --tags --abbrev=0 ${{ github.ref_name }}^ 2>/dev/null || echo "")
39+
40+
if [ -z "$PREV_TAG" ]; then
41+
echo "This is the first release"
42+
CHANGELOG=$(git log --pretty=format:"- %s (%h)" ${{ github.ref_name }})
43+
else
44+
echo "Changes since $PREV_TAG"
45+
CHANGELOG=$(git log --pretty=format:"- %s (%h)" ${PREV_TAG}..${{ github.ref_name }})
46+
fi
47+
48+
# Save to file to handle multiline
49+
cat > release_notes.md << 'EOF'
50+
## 📦 Release ${{ steps.version.outputs.version }}
51+
52+
### Changes in this release
53+
54+
$CHANGELOG
55+
56+
### 🔧 Building from Source
57+
58+
```bash
59+
# Clone the repository
60+
git clone https://github.com/${{ github.repository }}.git
61+
cd EntropyCore
62+
git checkout ${{ github.ref_name }}
63+
64+
# Basic build (minimal dependencies)
65+
cmake -B build -S .
66+
cmake --build build
67+
68+
# With Tracy profiler
69+
cmake -B build -S . -DENTROPY_WITH_TRACY=ON -DVCPKG_MANIFEST_FEATURES=tracy
70+
71+
# With tests
72+
cmake -B build -S . -DENTROPY_BUILD_TESTS=ON -DVCPKG_MANIFEST_FEATURES=tests
73+
```
74+
75+
### 📚 Documentation
76+
77+
See [README.md](https://github.com/${{ github.repository }}/blob/${{ github.ref_name }}/README.md) for complete documentation.
78+
79+
### 🐛 Reporting Issues
80+
81+
Found a bug? [Open an issue](https://github.com/${{ github.repository }}/issues/new)
82+
EOF
83+
84+
- name: Create Release
85+
uses: softprops/action-gh-release@v2
86+
with:
87+
name: "Release ${{ steps.version.outputs.version }}"
88+
body_path: release_notes.md
89+
draft: false
90+
prerelease: false
91+
make_latest: true
92+
generate_release_notes: true
93+
94+
- name: Announce release
95+
run: |
96+
echo "✅ Release ${{ steps.version.outputs.version }} created successfully!"
97+
echo "🔗 View at: https://github.com/${{ github.repository }}/releases/tag/${{ github.ref_name }}"

0 commit comments

Comments
 (0)