forked from aws-amplify/amplify-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgithub-rollback.ts
More file actions
26 lines (23 loc) · 758 Bytes
/
github-rollback.ts
File metadata and controls
26 lines (23 loc) · 758 Bytes
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
import { releasesRequest, semverToGithubTag } from './github-common';
import { join } from 'path';
/**
* This function expects a 'version' to already exist.
* The release with proved version is marked as latest.
*/
const markReleaseAsLatest = async (version: string) => {
const { id: releaseId } = await releasesRequest(join('tags', semverToGithubTag(version)));
const releaseIdStr = (releaseId as number).toString();
console.log(`Marking release ${version} as latest`);
await releasesRequest(releaseIdStr, {
method: 'PATCH',
body: JSON.stringify({
prerelease: false,
make_latest: 'true',
}),
});
};
const main = async () => {
const version = process.argv[2].trim();
await markReleaseAsLatest(version);
};
main();