Skip to content

Commit 2a820fd

Browse files
committed
first version with release
1 parent 232e32c commit 2a820fd

1 file changed

Lines changed: 22 additions & 48 deletions

File tree

.github/workflows/release.yml

Lines changed: 22 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,8 @@ jobs:
5959
- name: Get current version
6060
id: current_version
6161
run: |
62-
# Try to get the latest tag, default to 1.3.0 if no tags exist
63-
LATEST_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "v1.3.0")
62+
# Try to get the latest tag, default to 0.0.0 if no tags exist
63+
LATEST_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "v0.0.0")
6464
echo "tag=$LATEST_TAG" >> $GITHUB_OUTPUT
6565
# Remove 'v' prefix if present
6666
VERSION=${LATEST_TAG#v}
@@ -104,55 +104,34 @@ jobs:
104104
echo "tag=v$NEW_VERSION" >> $GITHUB_OUTPUT
105105
echo "New version: $NEW_VERSION"
106106
107-
- name: Extract changelog for this version
108-
id: changelog
107+
- name: Create release notes
108+
id: release_notes
109109
run: |
110-
# Extract relevant section from README changelog
111110
VERSION="${{ steps.new_version.outputs.version }}"
111+
BUMP_TYPE="${{ steps.version_type.outputs.type }}"
112112
113-
# Create a temporary changelog file
114-
cat > /tmp/release_notes.md << 'EOF'
115-
## Release ${{ steps.new_version.outputs.version }}
116-
117-
### Changes in this release
118-
119-
This release includes updates and improvements to the Linux Process Information Kernel Module.
120-
121-
See the [full changelog](https://github.com/${{ github.repository }}/blob/main/README.md#changelog) for details.
122-
EOF
123-
124-
# If there's a PR description, add it
113+
# Create release notes
125114
if [[ "${{ github.event_name }}" == "pull_request" ]]; then
126-
echo "" >> /tmp/release_notes.md
127-
echo "### Pull Request" >> /tmp/release_notes.md
128-
echo "${{ github.event.pull_request.title }}" >> /tmp/release_notes.md
129-
echo "" >> /tmp/release_notes.md
130-
echo "${{ github.event.pull_request.body }}" >> /tmp/release_notes.md
115+
# Use PR body for release notes
116+
cat > /tmp/release_notes.md << EOF
117+
## ${{ github.event.pull_request.title }}
118+
119+
${{ github.event.pull_request.body }}
120+
121+
---
122+
**Version**: $VERSION | **Type**: $BUMP_TYPE
123+
EOF
124+
else
125+
# Manual workflow dispatch
126+
cat > /tmp/release_notes.md << EOF
127+
Release $VERSION
128+
129+
**Version bump**: $BUMP_TYPE
130+
EOF
131131
fi
132132

133133
cat /tmp/release_notes.md
134134

135-
- name: Update version in README
136-
run: |
137-
VERSION="${{ steps.new_version.outputs.version }}"
138-
DATE=$(date +"%Y-%m-%d")
139-
EVENT_NAME="${{ github.event_name }}"
140-
BUMP_TYPE="${{ steps.version_type.outputs.type }}"
141-
142-
# Add new version to changelog in README
143-
if grep -q "## Changelog" README.md; then
144-
# Create the changelog entry
145-
ENTRY="### Version $VERSION ($DATE)"$'\n'"- Release created from $EVENT_NAME"$'\n'"- Version bump: $BUMP_TYPE"
146-
147-
# Insert new version after "## Changelog" line using awk
148-
awk -v entry="$ENTRY" '/## Changelog/ {print; print ""; print entry; next} 1' README.md > README.md.tmp
149-
mv README.md.tmp README.md
150-
151-
echo "Updated README.md with version $VERSION"
152-
git add README.md
153-
git commit -m "chore: bump version to $VERSION" || echo "No changes to commit"
154-
fi
155-
156135
- name: Create and push tag
157136
run: |
158137
TAG="${{ steps.new_version.outputs.tag }}"
@@ -169,8 +148,3 @@ jobs:
169148
body_path: /tmp/release_notes.md
170149
draft: false
171150
prerelease: false
172-
173-
- name: Push version update
174-
if: success()
175-
run: |
176-
git push origin main || echo "No changes to push"

0 commit comments

Comments
 (0)