fix(releases): more fun release stuff

This commit is contained in:
2025-07-12 15:30:44 -05:00
parent 4b9a2254df
commit f33554ed97
3 changed files with 17 additions and 15 deletions

View File

@@ -7,7 +7,7 @@
"npm": false,
"hooks": {
"after:bump": "echo Version bumped to ${version}",
"after:release": "node ./scripts/create-gitea-release.js"
"after:release": "node ./scripts/create-gitea-release.js ${version}"
},
"github": false,

View File

@@ -1,16 +1,10 @@
# Changelog
## [0.0.2-alpha.1](https://git.tuffraid.net/cowch/logistics_support_tool/compare/v0.0.2-alpha.0...v0.0.2-alpha.1) (2025-07-12)
### Bug Fixes
* **release:** removed version from being passed over ([30b39b8](https://git.tuffraid.net/cowch/logistics_support_tool/commit/30b39b836a8ac01aea3f7a4ddf3b6ec25d6a36cd))
## <small>0.0.1-alpha.1 (2025-07-12)</small>
* chore(release): v0.0.2-alpha.0 ([8b40d3f](https://git.tuffraid.net/cowch/logistics_support_tool/commits/8b40d3f))
* chore(release): v0.0.2-alpha.1 ([4b9a225](https://git.tuffraid.net/cowch/logistics_support_tool/commits/4b9a225))
* fix(package): made changes to get the correct alpha passed over in the prerelease stuff ([09e5fdf](https://git.tuffraid.net/cowch/logistics_support_tool/commits/09e5fdf))
* fix(release it): type in how i wrote the release-it file ([8664703](https://git.tuffraid.net/cowch/logistics_support_tool/commits/8664703))
* fix(release): removed version from being passed over ([30b39b8](https://git.tuffraid.net/cowch/logistics_support_tool/commits/30b39b8))
* ci(pakcage.json): missing plugin ([772463e](https://git.tuffraid.net/cowch/logistics_support_tool/commits/772463e))
* refactor(backend): change to just get a version bump ([01e2d40](https://git.tuffraid.net/cowch/logistics_support_tool/commits/01e2d40))
@@ -54,3 +48,6 @@
* feat(starter): intial starter release ([b370cb1](https://git.tuffraid.net/cowch/logistics_support_tool/commits/b370cb1))
* Initial commit ([e4d3fc9](https://git.tuffraid.net/cowch/logistics_support_tool/commits/e4d3fc9))
* Update README.md ([e081c8f](https://git.tuffraid.net/cowch/logistics_support_tool/commits/e081c8f))

View File

@@ -1,3 +1,8 @@
const version = process.argv[2];
if (!version) {
console.error("Version not passed to create-gitea-release.js");
process.exit(1);
}
import fs from 'fs-extra';
import { spawnSync } from 'child_process';
import fetch from 'node-fetch';
@@ -5,8 +10,8 @@ import dotenv from 'dotenv';
dotenv.config({ path: './.env' });
// Load package.json version
const pkg = await fs.readJson('package.json');
const version = pkg.version;
// const pkg = await fs.readJson('package.json');
// const version = pkg.version;
if (!version) {
console.error('Version not found in package.json');
@@ -16,7 +21,7 @@ if (!version) {
// Load build number from BUILD_NUMBER file
let buildNumber = '0';
try {
rawBuild = (await fs.readFile('BUILD_NUMBER', 'utf8')).trim();
rawBuild = (await fs.readFile('./BUILD_NUMBER', 'utf8')).trim();
if (rawBuild) {
const [numPart, namePart] = rawBuild.split('-');
const num = parseInt(numPart, 10);
@@ -67,14 +72,14 @@ const changelog = await fs.readFile('CHANGELOG.md', 'utf8');
const regex = new RegExp(`## \\[${version}\\][\\s\\S]*?(?=## \\[|$)`, 'm');
const releaseNotes = changelog.match(regex)?.[0] || changelog;
console.log(`Release notes for v${fullVersion}:\n`, releaseNotes);
console.log(`Release notes for v${version}:\n`, releaseNotes);
// 3) Create Gitea release
const createRelease = async () => {
const apiUrl = `https://${GITEA_URL}/api/v1/repos/${GITEA_USERNAME}/${GITEA_REPO}/releases`;
const releaseData = {
tag_name: `v${fullVersion}`,
name: `v${fullVersion}`,
tag_name: `v${version}`,
name: `v${version}`,
body: releaseNotes,
draft: false,
prerelease: true,