Skip to content

Commit 2cae5f3

Browse files
committed
clean up release
1 parent 1caf11d commit 2cae5f3

1 file changed

Lines changed: 95 additions & 0 deletions

File tree

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
name: Cleanup release
2+
3+
# Runs after a release tag is pushed to prepare for next development cycle
4+
# Can also be triggered manually for testing
5+
6+
on:
7+
push:
8+
tags:
9+
- "*"
10+
workflow_dispatch:
11+
inputs:
12+
test_tag:
13+
description: 'Tag version to simulate (e.g., 1.0.0)'
14+
required: true
15+
type: string
16+
17+
jobs:
18+
cleanup-release:
19+
name: Cleanup release
20+
runs-on: ubuntu-latest
21+
permissions:
22+
contents: write
23+
pull-requests: write
24+
env:
25+
# Use test_tag input if provided, otherwise use the actual tag
26+
RELEASE_TAG: ${{ inputs.test_tag || github.ref_name }}
27+
steps:
28+
- name: Checkout code
29+
uses: actions/checkout@v4
30+
with:
31+
ref: main
32+
fetch-depth: 0
33+
34+
- name: Increment Version
35+
id: version
36+
uses: nguyenvukhang/semver-increment@v1
37+
with:
38+
increment: patch
39+
version-file: version.properties
40+
version-regex: '^(.*)'
41+
42+
- name: Create release notes from current CHANGELOG
43+
run: |
44+
mkdir -p release-notes
45+
RELEASE_NOTES_FILE="release-notes/opensearch-protobufs.release-notes-${{ env.RELEASE_TAG }}.md"
46+
47+
# Create header
48+
echo "# OpenSearch Protobufs ${{ env.RELEASE_TAG }} Release Notes" > "$RELEASE_NOTES_FILE"
49+
echo "" >> "$RELEASE_NOTES_FILE"
50+
51+
# Copy changelog content (everything after the [Unreleased] header)
52+
sed -n '/^## \[Unreleased\]/,/^## \[/{ /^## \[Unreleased\]/d; /^## \[/d; p; }' CHANGELOG.md >> "$RELEASE_NOTES_FILE"
53+
54+
echo "Created $RELEASE_NOTES_FILE"
55+
56+
- name: Reset CHANGELOG for next iteration
57+
run: |
58+
cat > CHANGELOG.md << 'EOF'
59+
# CHANGELOG
60+
61+
Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
62+
63+
## [Unreleased]
64+
### Added
65+
66+
### Changed
67+
68+
### Deprecated
69+
70+
### Removed
71+
72+
### Fixed
73+
74+
### Security
75+
EOF
76+
77+
- name: Create Pull Request
78+
uses: peter-evans/create-pull-request@v7
79+
with:
80+
token: ${{ secrets.GITHUB_TOKEN }}
81+
commit-message: "Cleanup release ${{ env.RELEASE_TAG }}, prepare ${{ steps.version.outputs.version }}"
82+
signoff: true
83+
branch: cleanup-release/${{ env.RELEASE_TAG }}
84+
base: main
85+
delete-branch: true
86+
title: "Cleanup release ${{ env.RELEASE_TAG }}"
87+
body: |
88+
Release ${{ env.RELEASE_TAG }} has been drafted.
89+
90+
This PR prepares for the next development iteration (${{ steps.version.outputs.version }}).
91+
92+
### Changes:
93+
- Created release notes from CHANGELOG: `release-notes/opensearch-protobufs.release-notes-${{ env.RELEASE_TAG }}.md`
94+
- Reset `CHANGELOG.md` for next iteration
95+
- Bumped `version.properties` to `${{ steps.version.outputs.version }}`

0 commit comments

Comments
 (0)