Skip to content

Commit

Permalink
Version bump and added version bump script
Browse files Browse the repository at this point in the history
  • Loading branch information
tuhinpal committed Mar 16, 2024
1 parent 4fc0175 commit a8d12da
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 3 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<p align="center">
Master Your Money: Effortless Tracking and Smarter Spending
<br />
<a href="https://github.com/tuhinpal/cash_compass/releases/download/v0.1.1/app-release.apk"><strong>Download for Android »</strong></a>
<a href="https://github.com/tuhinpal/cash_compass/releases/download/v0.1.2/app-release.apk"><strong>Download for Android (v0.1.2) »</strong></a>
<br />
<br />
<a href="https://github.com/tuhinpal/cash_compass/releases">Releases</a>
Expand All @@ -35,7 +35,7 @@

## Install the app 🚀

You can download the app from the [by clicking here](https://github.com/tuhinpal/cash_compass/releases/download/v0.1.1/app-release.apk), you can also visit the [release section](https://github.com/tuhinpal/cash_compass/releases) to download specific version of the app.
You can download the app from the [by clicking here](https://github.com/tuhinpal/cash_compass/releases/download/v0.1.2/app-release.apk), you can also visit the [release section](https://github.com/tuhinpal/cash_compass/releases) to download specific version of the app.

## Contributing 🤝

Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: cash_compass
description: A new Flutter project.
publish_to: 'none'
version: 0.1.1
version: 0.1.2

environment:
sdk: '>=3.0.5 <4.0.0'
Expand Down
39 changes: 39 additions & 0 deletions scripts/versionBump.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
const fs = require("fs");

const getCurrentVersion = () => {
const pubspec = fs.readFileSync("pubspec.yaml", "utf8");
const version = pubspec.match(/version: (.*)/)[1];
return version;
};

const getNewVersion = (currentVersion) => {
let [major, minor, patch] = currentVersion.split(".").map((v) => parseInt(v));

if (patch >= 9) {
minor++;
patch = 0;
} else {
patch++;
}

return `${major}.${minor}.${patch}`;
};

const updatePubSpec = (newVersion) => {
const pubspec = fs.readFileSync("pubspec.yaml", "utf8");
const newPubspec = pubspec.replace(/version: (.*)/, `version: ${newVersion}`);
fs.writeFileSync("pubspec.yaml", newPubspec);
};

const updateReadme = (newVersion) => {
const readme = fs.readFileSync("README.md", "utf8");
const newReadme = readme.replace(/v\d+\.\d+\.\d+/g, `v${newVersion}`);
fs.writeFileSync("README.md", newReadme);
};

const currentVersion = getCurrentVersion();
const newVersion = getNewVersion(currentVersion);
console.log(`Bumping version from ${currentVersion} to ${newVersion}`);

updateReadme(newVersion);
updatePubSpec(newVersion);

0 comments on commit a8d12da

Please sign in to comment.