11import * as core from '@actions/core' ;
2- import * as exec from '@actions/exec' ;
3- import { detectPlatform , updateVersion } from './utils' ;
2+ import {
3+ detectPlatform ,
4+ updateVersion ,
5+ configureGitUser ,
6+ commitChanges ,
7+ createAndPushTag ,
8+ } from './utils' ;
49import semver from 'semver' ;
510
611async function run ( ) {
@@ -14,20 +19,9 @@ async function run() {
1419 core . setOutput ( 'new_version' , version ) ;
1520
1621 // Git Commit & Tag
17- await exec . exec ( 'git' , [ 'config' , 'user.name' , 'github-actions[bot]' ] ) ;
18- await exec . exec ( 'git' , [
19- 'config' ,
20- 'user.email' ,
21- 'github-actions[bot]@users.noreply.github.com' ,
22- ] ) ;
23-
24- await exec . exec ( 'git' , [ 'add' , '-A' ] ) ;
25- await exec . exec ( 'git' , [ 'diff-index' , '--quiet' , 'HEAD' ] ) . catch ( async ( ) => {
26- await exec . exec ( 'git' , [ 'commit' , '-m' , `chore: bump version to ${ version } ` ] ) ;
27- } ) ;
28-
29- await exec . exec ( 'git' , [ 'tag' , `v${ version } ` ] ) ;
30- await exec . exec ( 'git' , [ 'push' , 'origin' , 'HEAD' , '--tags' ] ) ;
22+ await configureGitUser ( ) ;
23+ await commitChanges ( `chore: bump version to ${ version } ` ) ;
24+ await createAndPushTag ( version ) ;
3125 } catch ( error : unknown ) {
3226 if ( error instanceof Error ) {
3327 core . setFailed ( error . message ) ;
0 commit comments