-
Notifications
You must be signed in to change notification settings - Fork 0
83 lines (73 loc) · 2.64 KB
/
release.yml
File metadata and controls
83 lines (73 loc) · 2.64 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
75
76
77
78
79
80
81
82
83
# Automated Releases
# Creates releases automatically when pushing to main
name: Release
on:
push:
branches:
- main
pull_request:
branches:
- main
permissions:
contents: write
jobs:
release:
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, '[skip release]')"
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Check if tags exist
id: check_tags
run: |
if [ $(git tag -l | wc -l) -eq 0 ]; then
echo "has_tags=false" >> $GITHUB_OUTPUT
echo "No tags found, creating initial release"
else
echo "has_tags=true" >> $GITHUB_OUTPUT
echo "Tags found, generating changelog"
fi
- name: Generate changelog
if: steps.check_tags.outputs.has_tags == 'true'
uses: mikepenz/release-changelog-builder-action@v6
id: changelog
with:
configuration: ""
- name: Create initial changelog
if: steps.check_tags.outputs.has_tags == 'false'
id: initial_changelog
run: |
echo "changelog<<EOF" >> $GITHUB_OUTPUT
echo "## 🎉 Initial Release" >> $GITHUB_OUTPUT
echo "" >> $GITHUB_OUTPUT
echo "This is the first automated release for CipherOcto." >> $GITHUB_OUTPUT
echo "" >> $GITHUB_OUTPUT
echo "### What's Included" >> $GITHUB_OUTPUT
echo "- Production-grade CI/CD workflows" >> $GITHUB_OUTPUT
echo "- Rust-first architecture setup" >> $GITHUB_OUTPUT
echo "- Branch protection and strategy" >> $GITHUB_OUTPUT
echo "" >> $GITHUB_OUTPUT
echo "### Changes since inception" >> $GITHUB_OUTPUT
echo '```' >> $GITHUB_OUTPUT
git log --pretty=format:"- %s" --reverse >> $GITHUB_OUTPUT
echo '```' >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
- name: Create Release
# Only create actual releases on push to main, not on PRs
if: github.event_name == 'push'
uses: softprops/action-gh-release@v2
with:
body: ${{ steps.changelog.outputs.changelog || steps.initial_changelog.outputs.changelog }}
draft: false
prerelease: false
tag_name: v0.1.0
name: v0.1.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: PR check (dry-run)
# Always pass on PRs without creating a release
if: github.event_name == 'pull_request'
run: |
echo "Release check passed (PR mode - no release created)"
echo "This check will create an actual release when merged to main"