[EXPAND] [[messages]] messageTitle = "QB Update for GT 2.8 (#681)" messageBody = """ [QB] [DETAILS] details = ["Fixes many Quest Book issues", "Updates QB with changes in GT 2.8"] [DETAILS] """ [[messages]] messageTitle = "Buildscript Refactor (#681)" messageBody = """ [INTERNAL] [DETAILS] details = ["**Important: Buildscript has changed from `npx gulp...` or `gulp...` to `npm run gulp...`**!", "Moves to Node 16 Package Management + Typescript Strict Mode", "New Port QB, Check QB and Fix QB Tasks"] [DETAILS] """ [EXPAND] Co-authored-by: Integer Limit <103940576+IntegerLimit@users.noreply.github.com> Co-authored-by: Ghzdude <44148655+ghzdude@users.noreply.github.com> Co-authored-by: SparkedTheorem <162088357+SparkedTheorem@users.noreply.github.com>
33 lines
1.1 KiB
TypeScript
33 lines
1.1 KiB
TypeScript
import { modpackManifest } from "#globals";
|
|
|
|
/**
|
|
* Transform the version field of manifest.json.
|
|
*/
|
|
export default async function transformManifestVersion(): Promise<void> {
|
|
// We're building a tag.
|
|
if (process.env.GITHUB_TAG) {
|
|
modpackManifest.version = process.env.GITHUB_TAG.replace(/^v/, "");
|
|
}
|
|
// If Pull Request Branch Name is provided and a 'True SHA' is provided
|
|
else if (process.env.GITHUB_HEAD_REF && process.env.TRUE_SHA) {
|
|
const shortCommit = process.env.TRUE_SHA.substring(0, 7);
|
|
modpackManifest.version = `${process.env.GITHUB_HEAD_REF}-${shortCommit}`;
|
|
}
|
|
// If SHA and ref is provided, append both the branch and short SHA.
|
|
else if (
|
|
process.env.GITHUB_SHA &&
|
|
process.env.GITHUB_REF &&
|
|
process.env.GITHUB_REF.startsWith("refs/heads/")
|
|
) {
|
|
const shortCommit = process.env.GITHUB_SHA.substring(0, 7);
|
|
const branch = /refs\/heads\/(.+)/.exec(process.env.GITHUB_REF)?.[1];
|
|
if (!branch) {
|
|
throw new Error(`Invalid git ref: ${process.env.GITHUB_REF}`);
|
|
}
|
|
|
|
modpackManifest.version = `${branch}-${shortCommit}`;
|
|
} else {
|
|
modpackManifest.version = "manual-build";
|
|
}
|
|
}
|