-
Notifications
You must be signed in to change notification settings - Fork 44
73 lines (61 loc) · 2.33 KB
/
prepare-for-release.yml
File metadata and controls
73 lines (61 loc) · 2.33 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
name: Prepare For Release
on:
workflow_dispatch:
inputs:
version:
description: 'Version number (e.g., 2.3.0)'
required: true
type: string
permissions:
contents: write
pull-requests: write
jobs:
prepare-release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Setup
uses: ./.github/actions/setup
- name: Validate Version Format
run: |
if ! [[ "${{ github.event.inputs.version }}" =~ ^[0-9]+\.[0-9]+\.[0-9]+(-[a-zA-Z0-9]+)?$ ]]; then
echo "::error::Invalid version format. Use semantic versioning (e.g., 2.3.0 or 2.3.0-beta1)"
exit 1
fi
- name: Update Changelog
id: update_changelog
run: |
new_version="${{ github.event.inputs.version }}"
echo "new_version=${new_version}" >> $GITHUB_OUTPUT
if grep -qF "## ${new_version}" CHANGELOG.md; then
echo "CHANGELOG.md already has an entry for ${new_version}, skipping."
else
tmp=$(mktemp)
echo "## ${new_version}" > "$tmp"
echo "" >> "$tmp"
cat CHANGELOG.md >> "$tmp"
mv "$tmp" CHANGELOG.md
fi
- name: Update Version
run: npm version "${{ github.event.inputs.version }}" --no-git-tag-version
- name: Build
run: yarn prepare
- name: Create Pull Request
uses: peter-evans/create-pull-request@4e1beaa7521e8b457b572c090b25bd3db56bf1c5 # v5
with:
token: ${{ secrets.GITHUB_TOKEN }}
title: "Prepare for Release ${{ steps.update_changelog.outputs.new_version }}"
body: |
# Prepare for Release ${{ steps.update_changelog.outputs.new_version }}
## SDK Release Checklist
- [ ] CHANGELOG.md updated with release notes
- [ ] Version bumped in package.json
- [ ] `yarn prepare` ran successfully (itblBuildInfo.ts updated)
- [ ] All tests passing
- [ ] Documentation updated (if needed)
branch: "prepare-for-release-${{ steps.update_changelog.outputs.new_version }}"
commit-message: "Prepare for release ${{ steps.update_changelog.outputs.new_version }}"
labels: release
delete-branch: true