-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
971bc48
commit 02458c5
Showing
11 changed files
with
105 additions
and
83 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,37 @@ | ||
name: 'Mobile Version Bump' | ||
description: 'Bump Android & iOS versions' | ||
name: "Mobile Version Bump" | ||
description: "Bump Android & iOS versions" | ||
|
||
inputs: | ||
android-project-path: | ||
description: '*Required. The path to the Android project. If not provided, the Android version will not be bumped.' | ||
description: "*Required. The path to the Android project. If not provided, the Android version will not be bumped." | ||
required: false | ||
ios-project-path: | ||
description: '*Required. The path to the iOS project. If not provided, the iOS version will not be bumped.' | ||
description: "*Required. The path to the iOS project. If not provided, the iOS version will not be bumped." | ||
required: false | ||
bump-type: | ||
description: 'The type of bump to perform. Can be one of: major, minor, patch.' | ||
description: "The type of bump to perform. Can be one of: major, minor, patch." | ||
required: false | ||
build-number: | ||
description: 'The build number to use for the iOS version. If not provided, the build number will be incremented by 1.' | ||
description: "The build number to use for the iOS version. If not provided, the build number will be incremented by 1." | ||
required: false | ||
version-code: | ||
description: 'The version code to use for the Android version. If not provided, the version code will be incremented by 1.' | ||
description: "The version code to use for the Android version. If not provided, the version code will be incremented by 1." | ||
required: false | ||
|
||
outputs: | ||
android-version: | ||
description: 'The new Android version.' | ||
description: "The new Android version." | ||
android-version-code: | ||
description: 'The new Android version code.' | ||
description: "The new Android version code." | ||
ios-version: | ||
description: 'The new iOS version.' | ||
description: "The new iOS version." | ||
ios-build-number: | ||
description: 'The new iOS build number.' | ||
description: "The new iOS build number." | ||
|
||
runs: | ||
using: 'node16' | ||
main: './dist/index.js' | ||
using: "node20" | ||
main: "./dist/index.js" | ||
|
||
branding: | ||
color: 'purple' | ||
icon: 'arrow-up-circle' | ||
color: "purple" | ||
icon: "arrow-up-circle" |
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,16 @@ | ||
export const bumpedVersion = (version: string, bumpType: string) => { | ||
const [major, minor, patch] = version.replace(new RegExp('"', 'g'), '').split(".") | ||
const [major, minor, patch] = version | ||
.replace(new RegExp('"', "g"), "") | ||
.split("."); | ||
|
||
switch (bumpType) { | ||
case "major": | ||
return `${parseInt(major) + 1}.0.0` | ||
return `${parseInt(major) + 1}.0.0`; | ||
case "minor": | ||
return `${major}.${parseInt(minor) + 1}.0` | ||
return `${major}.${parseInt(minor) + 1}.0`; | ||
case "patch": | ||
return `${major}.${minor}.${parseInt(patch) + 1}` | ||
return `${major}.${minor}.${parseInt(patch) + 1}`; | ||
default: | ||
return version | ||
return version; | ||
} | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,36 @@ | ||
import { setFailed, getInput } from "@actions/core" | ||
import { bumpAndroidValues } from "./android" | ||
import { bumpIosValues } from "./ios" | ||
import { Input } from "./types" | ||
import { setFailed, getInput } from "@actions/core"; | ||
import { bumpAndroidValues } from "./android"; | ||
import { bumpIosValues } from "./ios"; | ||
import { Input } from "./types"; | ||
|
||
const run = () => { | ||
const androidPath = getInput(Input.AndroidProjectPath) | ||
const iosPath = getInput(Input.IosProjectPath) | ||
const bumpType = getInput(Input.BumpType) | ||
const versionCode = getInput(Input.VersionCode) | ||
const buildNumber = getInput(Input.BuildNumber) | ||
const appVersion = getInput(Input.AppVersion) | ||
const androidPath = getInput(Input.AndroidProjectPath); | ||
const iosPath = getInput(Input.IosProjectPath); | ||
const bumpType = getInput(Input.BumpType); | ||
const versionCode = getInput(Input.VersionCode); | ||
const buildNumber = getInput(Input.BuildNumber); | ||
const appVersion = getInput(Input.AppVersion); | ||
|
||
if (androidPath) { | ||
bumpAndroidValues({ version: appVersion, androidPath, versionCode, bumpType }) | ||
bumpAndroidValues({ | ||
version: appVersion, | ||
androidPath, | ||
versionCode, | ||
bumpType, | ||
}); | ||
} else { | ||
console.log("No android path provided. Skipping...") | ||
console.log("No android path provided. Skipping..."); | ||
} | ||
|
||
if (iosPath) { | ||
bumpIosValues({ version: appVersion, iosPath, buildNumber, bumpType }) | ||
bumpIosValues({ version: appVersion, iosPath, buildNumber, bumpType }); | ||
} else { | ||
console.log("No ios path provided. Skipping...") | ||
console.log("No ios path provided. Skipping..."); | ||
} | ||
} | ||
}; | ||
|
||
try { | ||
run() | ||
run(); | ||
} catch (error) { | ||
setFailed(error.message) | ||
setFailed(error.message); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters