|
| 1 | +name: Prepare For Release |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + inputs: |
| 6 | + version: |
| 7 | + description: 'Version number (e.g., 2.3.0)' |
| 8 | + required: true |
| 9 | + type: string |
| 10 | + |
| 11 | +permissions: |
| 12 | + contents: write |
| 13 | + pull-requests: write |
| 14 | + |
| 15 | +jobs: |
| 16 | + prepare-release: |
| 17 | + runs-on: ubuntu-latest |
| 18 | + steps: |
| 19 | + - uses: actions/checkout@v4 |
| 20 | + with: |
| 21 | + token: ${{ secrets.GITHUB_TOKEN }} |
| 22 | + |
| 23 | + - name: Setup |
| 24 | + uses: ./.github/actions/setup |
| 25 | + |
| 26 | + - name: Validate Version Format |
| 27 | + run: | |
| 28 | + if ! [[ "${{ github.event.inputs.version }}" =~ ^[0-9]+\.[0-9]+\.[0-9]+(-[a-zA-Z0-9]+)?$ ]]; then |
| 29 | + echo "::error::Invalid version format. Use semantic versioning (e.g., 2.3.0 or 2.3.0-beta1)" |
| 30 | + exit 1 |
| 31 | + fi |
| 32 | +
|
| 33 | + - name: Update Changelog |
| 34 | + id: update_changelog |
| 35 | + run: | |
| 36 | + new_version="${{ github.event.inputs.version }}" |
| 37 | + echo "new_version=${new_version}" >> $GITHUB_OUTPUT |
| 38 | +
|
| 39 | + if grep -qF "## ${new_version}" CHANGELOG.md; then |
| 40 | + echo "CHANGELOG.md already has an entry for ${new_version}, skipping." |
| 41 | + else |
| 42 | + tmp=$(mktemp) |
| 43 | + echo "## ${new_version}" > "$tmp" |
| 44 | + echo "" >> "$tmp" |
| 45 | + cat CHANGELOG.md >> "$tmp" |
| 46 | + mv "$tmp" CHANGELOG.md |
| 47 | + fi |
| 48 | +
|
| 49 | + - name: Update Version |
| 50 | + run: npm version "${{ github.event.inputs.version }}" --no-git-tag-version |
| 51 | + |
| 52 | + - name: Build |
| 53 | + run: yarn prepare |
| 54 | + |
| 55 | + - name: Create Pull Request |
| 56 | + uses: peter-evans/create-pull-request@v5 |
| 57 | + with: |
| 58 | + token: ${{ secrets.GITHUB_TOKEN }} |
| 59 | + title: "Prepare for Release ${{ steps.update_changelog.outputs.new_version }}" |
| 60 | + body: | |
| 61 | + # Prepare for Release ${{ steps.update_changelog.outputs.new_version }} |
| 62 | +
|
| 63 | + ## SDK Release Checklist |
| 64 | + - [ ] CHANGELOG.md updated with release notes |
| 65 | + - [ ] Version bumped in package.json |
| 66 | + - [ ] `yarn prepare` ran successfully (itblBuildInfo.ts updated) |
| 67 | + - [ ] All tests passing |
| 68 | + - [ ] Documentation updated (if needed) |
| 69 | +
|
| 70 | + branch: "prepare-for-release-${{ steps.update_changelog.outputs.new_version }}" |
| 71 | + commit-message: "Prepare for release ${{ steps.update_changelog.outputs.new_version }}" |
| 72 | + labels: release |
| 73 | + delete-branch: true |
0 commit comments