Skip to content

Commit

Permalink
Merge branch 'main' into feat/project-landingpage
Browse files Browse the repository at this point in the history
  • Loading branch information
Noggling committed Nov 18, 2024
2 parents e00c8a9 + 84d09bd commit f8427c6
Showing 1 changed file with 14 additions and 7 deletions.
21 changes: 14 additions & 7 deletions github-action/src/utils/bumpVersion.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,20 @@ import { HttpClient } from '@actions/http-client';
// For now we ask the server what the latest version is and bump the patch version
export async function getVersion(ciUrl: string, token: string, name: string) {
const client = new HttpClient();
const response = await client.get(`${ciUrl}/apps/${name}?api-version=1.0`, {
['Authorization']: `Bearer ${token}`,
});
const body = await response.readBody();
const json = JSON.parse(body);
const v = incrementPatchVersion(json.build.version);
return v;
try {
const response = await client.get(`${ciUrl}/apps/${name}?api-version=1.0`, {
['Authorization']: `Bearer ${token}`,
});
const body = await response.readBody();
const json = JSON.parse(body);
const v = incrementPatchVersion(json.build.version);
return v;

} catch (error) {
console.warn("Failed to get version from server", error);
console.info("Falling back to 0.0.1");
return "0.0.1";
}
}

function incrementPatchVersion(semver: string) {
Expand Down

0 comments on commit f8427c6

Please sign in to comment.