-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.ts
More file actions
29 lines (25 loc) · 826 Bytes
/
main.ts
File metadata and controls
29 lines (25 loc) · 826 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
27
28
29
import { cleanUnsafe, sort } from "./version.ts";
import { getGitLabVersion } from "./dockerhub.ts";
import { getGCRVersion } from "./github.ts";
const gitlab = cleanUnsafe(await getGitLabVersion());
sort(gitlab);
const data = gitlab.slice(gitlab.length - 3);
const gcr = await getGCRVersion();
const s = new Set(gcr);
const tags = data.map((v) => {
if (!s.has(`v${v.toString()}`)) return v.toString();
return "";
}).filter((v) => v !== "");
console.log(tags);
if (tags.length !== 0) {
for (const v of tags) {
await fetch("https://api.github.com/repos/x2ox/gitlab-db/git/refs", {
body: JSON.stringify({
"ref": `refs/tags/v${v}`,
"sha": `${Deno.env.get("GITHUB_SHA")}`,
}),
headers: { Authorization: `token ${Deno.env.get("GITHUB_TOKEN")}` },
method: "POST",
});
}
}