-
Notifications
You must be signed in to change notification settings - Fork 2
202 lines (158 loc) Β· 6.41 KB
/
create-release.yml
File metadata and controls
202 lines (158 loc) Β· 6.41 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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
name: Release Proposal
on:
push:
tags:
- 'v*.*.*'
permissions:
contents: write
issues: write
jobs:
check-version-type:
runs-on: ubuntu-22.04
outputs:
should_create_issue: ${{ steps.check-type.outputs.should_create }}
version: ${{ steps.extract.outputs.version }}
version_type: ${{ steps.check-type.outputs.version_type }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Extract version from tag
id: extract
run: |
TAG="${{ github.ref_name }}"
VERSION="${TAG#v}"
echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "π·οΈ Processing version: $VERSION"
- name: Determine version type
id: check-type
run: |
VERSION="${{ steps.extract.outputs.version }}"
# Parse version components
IFS='.' read -r MAJOR MINOR PATCH <<< "$VERSION"
# Determine if this is a minor or major release
if [[ "$PATCH" == "0" ]]; then
if [[ "$MINOR" == "0" ]]; then
echo "version_type=major" >> $GITHUB_OUTPUT
echo "should_create=true" >> $GITHUB_OUTPUT
echo "π Major release detected: $VERSION"
else
echo "version_type=minor" >> $GITHUB_OUTPUT
echo "should_create=true" >> $GITHUB_OUTPUT
echo "β¨ Minor release detected: $VERSION"
fi
else
echo "version_type=patch" >> $GITHUB_OUTPUT
echo "should_create=false" >> $GITHUB_OUTPUT
echo "βοΈ Patch release detected: $VERSION - skipping release proposal"
fi
create-release-issue:
needs: check-version-type
if: needs.check-version-type.outputs.should_create_issue == 'true'
runs-on: ubuntu-22.04
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Extract changelog data
id: extract-data
run: |
VERSION="${{ needs.check-version-type.outputs.version }}"
echo "π Extracting changelog data for v$VERSION..."
# Make script executable
chmod +x scripts/generate-release-notes.sh
# Extract changelog data
./scripts/generate-release-notes.sh "$VERSION" > /tmp/changelog-data.md
if [[ ! -s /tmp/changelog-data.md ]]; then
echo "β Error: Failed to extract changelog data"
exit 1
fi
echo "β
Changelog data extracted successfully"
- name: Close existing release proposal issues
run: |
VERSION="${{ needs.check-version-type.outputs.version }}"
# Find and close any existing release proposal issues for this version
EXISTING_ISSUES=$(gh issue list \
--search "Release v$VERSION in:title" \
--state open \
--json number \
--jq '.[].number')
if [[ -n "$EXISTING_ISSUES" ]]; then
echo "π Closing existing release proposal issues..."
for issue in $EXISTING_ISSUES; do
gh issue close "$issue" --comment "Superseded by new release proposal."
echo " Closed issue #$issue"
done
fi
env:
GH_TOKEN: ${{ github.token }}
- name: Create release proposal issue
run: |
VERSION="${{ needs.check-version-type.outputs.version }}"
VERSION_TYPE="${{ needs.check-version-type.outputs.version_type }}"
# Create issue body using the same structure as the template
cat > /tmp/issue-body.md <<'ISSUE_BODY'
## π― Task: Create GitHub Release for v$VERSION
A **$VERSION_TYPE** release has been tagged and requires a GitHub release with human-readable notes.
**Note**: This issue was automatically created. Patch releases are skipped.
---
## π Raw Changelog Data
<details>
<summary>Click to view extracted changelog data</summary>
```markdown
CHANGELOG_DATA_PLACEHOLDER
```
</details>
---
## βοΈ Instructions for @copilot
Please create a GitHub release for **v$VERSION** with the following requirements:
### Requirements:
1. **Summarize the changes** in human-readable language (do NOT copy/paste the raw entries)
2. **For $VERSION_TYPE releases**:
- Create a brief overview of the main improvements
- Summarize all included patches/minors (shown above) into key themes or categories
3. **Use clear, simple language** that non-technical users can understand
4. **Keep it concise** - aim for 3-5 key points maximum
5. **Include impact**: Explain what these changes mean for users
### Expected Release Note Format:
```markdown
## What's New in v$VERSION
[2-3 paragraph human-readable summary of the release]
### Key Improvements
- [Summarized key point 1]
- [Summarized key point 2]
- [Summarized key point 3]
### Changes Included
[Brief summary of patches/minors if applicable]
---
Full changelog: [CHANGELOG.md](https://github.com/DrozmotiX/ioBroker-Copilot-Instructions/blob/main/CHANGELOG.md)
```
### Actions:
1. Review the raw changelog data above
2. Create a human-readable summary following the format
3. Create the GitHub release using:
```bash
gh release create v$VERSION --title "Release $VERSION" --notes "<your summary>"
```
4. Reply to this issue with the release URL once created
---
**Note**: This is a **$VERSION_TYPE** release. Focus on overall impact rather than listing every detail.
ISSUE_BODY
# Insert the changelog data
sed -i '/CHANGELOG_DATA_PLACEHOLDER/r /tmp/changelog-data.md' /tmp/issue-body.md
sed -i '/CHANGELOG_DATA_PLACEHOLDER/d' /tmp/issue-body.md
# Replace placeholders
sed -i "s/\$VERSION/$VERSION/g" /tmp/issue-body.md
sed -i "s/\$VERSION_TYPE/$VERSION_TYPE/g" /tmp/issue-body.md
# Create the issue and assign to copilot
gh issue create \
--title "Release v$VERSION ($VERSION_TYPE)" \
--body-file /tmp/issue-body.md \
--label "release-proposal" \
--label "$VERSION_TYPE-release" \
--assignee "copilot"
echo "β
Release proposal issue created and assigned to @copilot for v$VERSION"
env:
GH_TOKEN: ${{ github.token }}