-
Notifications
You must be signed in to change notification settings - Fork 1
92 lines (77 loc) · 2.81 KB
/
Copy pathversion-bump.yaml
File metadata and controls
92 lines (77 loc) · 2.81 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
name: Version Bump
on:
workflow_dispatch:
inputs:
version-type:
description: 'Version type to bump'
required: true
default: 'patch'
type: choice
options:
- patch
- minor
- major
- prerelease
prerelease-id:
description: 'Prerelease identifier (e.g., beta, alpha)'
required: false
default: 'beta'
permissions:
contents: write
pull-requests: write
jobs:
bump-version:
name: Bump Version
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 22.x
- name: Configure Git
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
- name: Bump version
id: bump
run: |
# Get current version
CURRENT_VERSION=$(node -p "require('./package.json').version")
echo "Current version: $CURRENT_VERSION"
# Bump version based on input
if [ "${{ inputs.version-type }}" == "prerelease" ]; then
npm version prerelease --preid=${{ inputs.prerelease-id }} --no-git-tag-version
else
npm version ${{ inputs.version-type }} --no-git-tag-version
fi
# Get new version
NEW_VERSION=$(node -p "require('./package.json').version")
echo "New version: $NEW_VERSION"
echo "new-version=$NEW_VERSION" >> $GITHUB_OUTPUT
- name: Create Pull Request
uses: peter-evans/create-pull-request@v6
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: "chore: bump version to ${{ steps.bump.outputs.new-version }}"
title: "chore: bump version to ${{ steps.bump.outputs.new-version }}"
body: |
## Version Bump
This PR bumps the version from `${{ steps.bump.outputs.current-version }}` to `${{ steps.bump.outputs.new-version }}`.
### Type of change
- Version bump: `${{ inputs.version-type }}`
${{ inputs.version-type == 'prerelease' && format('- Prerelease ID: `{0}`', inputs.prerelease-id) || '' }}
### Checklist
- [ ] Version number follows semantic versioning
- [ ] No breaking changes (or they are documented)
- [ ] Ready for release after merge
---
*This PR was automatically created by the Version Bump workflow.*
branch: version-bump-${{ steps.bump.outputs.new-version }}
delete-branch: true
labels: |
version-bump
automated-pr