deno.land / std@0.224.0 / _tools / release / 03_release.ts

نووسراو ببینە
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#!/usr/bin/env -S deno run --allow-read --allow-write --allow-env --allow-net --allow-run=git --no-check// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.import { containsVersion, createOctoKit, getGitHubRepository } from "./deps.ts";import { getReleasesMdFile, loadRepo, VersionFile } from "./repo.ts";
const repo = await loadRepo();
// only run this for commits that contain a version number in the commit messageif (!containsVersion(await repo.gitCurrentCommitMessage())) { console.log("Exiting: No version found in commit name."); Deno.exit();}
// ensure this is the main branchif ((await repo.gitCurrentBranch()) !== "main") { console.log("Exiting: Not on main branch."); Deno.exit();}
// now attempt to create a release by tagging// the repo and creating a draft releaseconst versionFile = new VersionFile();const releasesMd = getReleasesMdFile();
await repo.gitFetchTags("origin");const repoTags = await repo.getGitTags();const tagName = versionFile.version.toString();
if (repoTags.has(tagName)) { console.log(`Tag ${tagName} already exists.`);} else { console.log(`Tagging ${tagName}...`); await repo.gitTag(tagName); await repo.gitPush("origin", tagName);
console.log(`Creating release...`); await createOctoKit().request(`POST /repos/{owner}/{repo}/releases`, { ...getGitHubRepository(), tag_name: tagName, name: tagName, body: releasesMd.getLatestReleaseText().fullText, draft: true, });}
std

Version Info

Tagged at
8 months ago