Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a4bb860526 | ||
|
|
6797dbada2 | ||
|
|
2ca1e67435 | ||
|
|
ab955afad4 | ||
|
|
f442797a86 | ||
|
|
6ca92fcc21 |
@@ -7,6 +7,7 @@ on:
|
|||||||
|
|
||||||
permissions:
|
permissions:
|
||||||
contents: write
|
contents: write
|
||||||
|
actions: write
|
||||||
id-token: write
|
id-token: write
|
||||||
|
|
||||||
concurrency:
|
concurrency:
|
||||||
|
|||||||
+2
-1
@@ -12,7 +12,8 @@
|
|||||||
[
|
[
|
||||||
"@semantic-release/exec",
|
"@semantic-release/exec",
|
||||||
{
|
{
|
||||||
"prepareCmd": "node ./.semrel/prepare.mjs '${nextRelease.version}' && bunx biome check package.json flake.nix CHANGELOG.md 2>/dev/null || true"
|
"prepareCmd": "node ./.semrel/prepare.mjs '${nextRelease.version}' && bunx biome check package.json flake.nix CHANGELOG.md 2>/dev/null || true",
|
||||||
|
"successCmd": "node ./.semrel/dispatch.mjs '${nextRelease.version}'"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
|
|||||||
@@ -0,0 +1,53 @@
|
|||||||
|
#!/usr/bin/env node
|
||||||
|
/**
|
||||||
|
* successCmd hook for semantic-release: dispatch the deploy workflow so the
|
||||||
|
* freshly released version is built and deployed to the VPS.
|
||||||
|
*
|
||||||
|
* GitHub disables workflow re-triggering for pushes made by GITHUB_TOKEN
|
||||||
|
* (which is what @semantic-release/git uses to commit the release), so the
|
||||||
|
* plain `push: branches: [main]` trigger in deploy.yml never fires for the
|
||||||
|
* release commit. We dispatch deploy.yml explicitly instead.
|
||||||
|
*/
|
||||||
|
|
||||||
|
const version = (process.argv[2] || '').trim();
|
||||||
|
|
||||||
|
async function main() {
|
||||||
|
const token = process.env.GITHUB_TOKEN;
|
||||||
|
if (!token) {
|
||||||
|
console.error('dispatch.mjs: GITHUB_TOKEN not set, skipping deploy dispatch');
|
||||||
|
process.exit(0);
|
||||||
|
}
|
||||||
|
if (!version) {
|
||||||
|
console.error('dispatch.mjs: no version argument, skipping');
|
||||||
|
process.exit(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
const repo = process.env.GITHUB_REPOSITORY || 'asepharyana/TeleUploader';
|
||||||
|
const url = `https://api.github.com/repos/${repo}/actions/workflows/deploy.yml/dispatches`;
|
||||||
|
|
||||||
|
// dispatch with branch ref main; deploy builds #teleuploader from the
|
||||||
|
// release commit whose package.json/flake.nix already carry `version`
|
||||||
|
const res = await fetch(url, {
|
||||||
|
method: 'POST',
|
||||||
|
headers: {
|
||||||
|
Authorization: `Bearer ${token}`,
|
||||||
|
'Content-Type': 'application/json',
|
||||||
|
'User-Agent': 'semantic-release-dispatch',
|
||||||
|
},
|
||||||
|
body: JSON.stringify({ ref: 'main' }),
|
||||||
|
});
|
||||||
|
|
||||||
|
if (res.status === 204) {
|
||||||
|
console.log(`dispatch.mjs: dispatched deploy for v${version} to ${repo} main`);
|
||||||
|
} else {
|
||||||
|
const body = await res.text().catch(() => '');
|
||||||
|
console.error(`dispatch.mjs: deploy dispatch failed (HTTP ${res.status}): ${body}`);
|
||||||
|
// Non-fatal: a user can still run the deploy workflow manually.
|
||||||
|
process.exit(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
main().catch((err) => {
|
||||||
|
console.error('dispatch.mjs: unexpected error:', err);
|
||||||
|
process.exit(0);
|
||||||
|
});
|
||||||
+20
-2
@@ -12,6 +12,11 @@
|
|||||||
* while the VPS profile stayed on the old build. By bumping flake.nix's
|
* while the VPS profile stayed on the old build. By bumping flake.nix's
|
||||||
* `version` on every release, the Nix derivation always changes and the
|
* `version` on every release, the Nix derivation always changes and the
|
||||||
* store path is always fresh.
|
* store path is always fresh.
|
||||||
|
*
|
||||||
|
* IMPORTANT: only bump the TeleUploader package version (the block whose
|
||||||
|
* `pname = "teleuploader"` precedes it), never the Bun overlay version that
|
||||||
|
* appears earlier in the file. Store path is derived from the
|
||||||
|
* teleuploader package's `version`.
|
||||||
*/
|
*/
|
||||||
import { readFileSync, writeFileSync } from 'node:fs';
|
import { readFileSync, writeFileSync } from 'node:fs';
|
||||||
|
|
||||||
@@ -27,9 +32,22 @@ writeFileSync(pkgPath, `${JSON.stringify(pkg, null, 2)}\n`);
|
|||||||
const flakePath = 'flake.nix';
|
const flakePath = 'flake.nix';
|
||||||
let flake = readFileSync(flakePath, 'utf8');
|
let flake = readFileSync(flakePath, 'utf8');
|
||||||
const target = nextVersion ?? pkg.version;
|
const target = nextVersion ?? pkg.version;
|
||||||
const replaced = flake.replace(/version = "\d+\.\d+\.\d+";/, `version = "${target}";`);
|
|
||||||
|
const anchor = 'pname = "teleuploader";';
|
||||||
|
const anchorIdx = flake.indexOf(anchor);
|
||||||
|
if (anchorIdx === -1) {
|
||||||
|
throw new Error(`prepare.mjs: TeleUploader pname anchor not found in ${flakePath}`);
|
||||||
|
}
|
||||||
|
const rest = flake.slice(anchorIdx);
|
||||||
|
const verMatch = rest.match(/(\s*)version = "\d+\.\d+\.\d+";/);
|
||||||
|
if (!verMatch) {
|
||||||
|
throw new Error(`prepare.mjs: could not locate TeleUploader version block in ${flakePath}`);
|
||||||
|
}
|
||||||
|
const replaced =
|
||||||
|
flake.slice(0, anchorIdx) +
|
||||||
|
rest.replace(/(\s*)version = "\d+\.\d+\.\d+";/, `$1version = "${target}";`);
|
||||||
if (!replaced.includes(`version = "${target}";`)) {
|
if (!replaced.includes(`version = "${target}";`)) {
|
||||||
throw new Error(`prepare.mjs: could not update version in ${flakePath} (pattern not found)`);
|
throw new Error(`prepare.mjs: replacement did not land in ${flakePath}`);
|
||||||
}
|
}
|
||||||
writeFileSync(flakePath, replaced);
|
writeFileSync(flakePath, replaced);
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,17 @@
|
|||||||
|
## [1.2.2](https://github.com/asepharyana/TeleUploader/compare/v1.2.1...v1.2.2) (2026-09-05)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* **health:** resolve app version in Nix bundle at runtime ([6797dba](https://github.com/asepharyana/TeleUploader/commit/6797dbada27873b14c064e238589e61ad3ecb67c))
|
||||||
|
|
||||||
|
## [1.2.1](https://github.com/asepharyana/TeleUploader/compare/v1.2.0...v1.2.1) (2026-09-05)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* **ci:** bump only TeleUploader flake version, not Bun overlay ([f442797](https://github.com/asepharyana/TeleUploader/commit/f442797a86e845853c28dc22432a530560434488))
|
||||||
|
|
||||||
# [1.2.0](https://github.com/asepharyana/TeleUploader/compare/v1.1.1...v1.2.0) (2026-09-05)
|
# [1.2.0](https://github.com/asepharyana/TeleUploader/compare/v1.1.1...v1.2.0) (2026-09-05)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
overlays = [
|
overlays = [
|
||||||
(self: super: {
|
(self: super: {
|
||||||
bun = super.bun.overrideAttrs (old: rec {
|
bun = super.bun.overrideAttrs (old: rec {
|
||||||
version = "1.2.0";
|
version = "1.3.14";
|
||||||
src = super.fetchzip {
|
src = super.fetchzip {
|
||||||
url = "https://github.com/oven-sh/bun/releases/download/bun-v1.3.14/bun-linux-x64.zip";
|
url = "https://github.com/oven-sh/bun/releases/download/bun-v1.3.14/bun-linux-x64.zip";
|
||||||
sha256 = "sha256:189kasncnfpq6q37q3w80dv2a92w79w20x2x6hf1fbkir5gyvzlb";
|
sha256 = "sha256:189kasncnfpq6q37q3w80dv2a92w79w20x2x6hf1fbkir5gyvzlb";
|
||||||
@@ -27,7 +27,7 @@
|
|||||||
# TeleUploader package
|
# TeleUploader package
|
||||||
teleuploader = pkgs.stdenvNoCC.mkDerivation rec {
|
teleuploader = pkgs.stdenvNoCC.mkDerivation rec {
|
||||||
pname = "teleuploader";
|
pname = "teleuploader";
|
||||||
version = "1.1.1";
|
version = "1.2.2";
|
||||||
|
|
||||||
src = ./.;
|
src = ./.;
|
||||||
|
|
||||||
@@ -61,6 +61,9 @@
|
|||||||
cp -r dist $out/share/teleuploader/dist
|
cp -r dist $out/share/teleuploader/dist
|
||||||
cp src/home.html $out/share/teleuploader/ 2>/dev/null || true
|
cp src/home.html $out/share/teleuploader/ 2>/dev/null || true
|
||||||
cp schema.sql $out/share/teleuploader/ 2>/dev/null || true
|
cp schema.sql $out/share/teleuploader/ 2>/dev/null || true
|
||||||
|
# Carry package.json into the store so runtime version lookup in
|
||||||
|
# env.ts readPackageVersion() resolves (dist/../package.json).
|
||||||
|
cp package.json $out/share/teleuploader/package.json
|
||||||
|
|
||||||
# Wrap with bun from Nix store (dependency sharing!)
|
# Wrap with bun from Nix store (dependency sharing!)
|
||||||
# Note: NO --chdir — systemd WorkingDirectory controls this
|
# Note: NO --chdir — systemd WorkingDirectory controls this
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "filedrop",
|
"name": "filedrop",
|
||||||
"version": "1.2.0",
|
"version": "1.2.2",
|
||||||
"description": "Telegram file uploader backend",
|
"description": "Telegram file uploader backend",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
+17
-18
@@ -1,3 +1,4 @@
|
|||||||
|
import { readFileSync } from 'node:fs';
|
||||||
import logger from './shared/logger/index';
|
import logger from './shared/logger/index';
|
||||||
import { TELEGRAM_CHUNK_SIZE_MAX_BYTES } from './shared/utils/validation';
|
import { TELEGRAM_CHUNK_SIZE_MAX_BYTES } from './shared/utils/validation';
|
||||||
|
|
||||||
@@ -143,25 +144,23 @@ if (telegramChunkSizeBytes > TELEGRAM_CHUNK_SIZE_MAX_BYTES) {
|
|||||||
* value always matches the deployed build.
|
* value always matches the deployed build.
|
||||||
*/
|
*/
|
||||||
const readPackageVersion = (): string => {
|
const readPackageVersion = (): string => {
|
||||||
try {
|
// Candidates in priority order. In the Nix bundle the app lives at
|
||||||
const candidates = [
|
// $out/share/teleuploader/dist/index.js, so the package.json that was
|
||||||
// node_modules resolution is only available when installed as a dep
|
// copied alongside it is one level up from import.meta.dir. In a dev
|
||||||
import.meta.dir ? `${import.meta.dir}/../package.json` : undefined,
|
// checkout it sits in the repo root (process.cwd()). Bun bundles JSON
|
||||||
`${process.cwd()}/package.json`,
|
// imports statically, so we read the file at runtime instead.
|
||||||
];
|
const candidates = [
|
||||||
for (const candidate of candidates) {
|
import.meta.dir ? `${import.meta.dir}/../package.json` : undefined,
|
||||||
if (!candidate) continue;
|
`${process.cwd()}/package.json`,
|
||||||
try {
|
];
|
||||||
const pkg = JSON.parse(import.meta.require(candidate).default ?? '{}') as {
|
for (const candidate of candidates) {
|
||||||
version?: string;
|
if (!candidate) continue;
|
||||||
};
|
try {
|
||||||
if (pkg.version) return pkg.version;
|
const parsed = JSON.parse(readFileSync(candidate, 'utf8')) as { version?: string };
|
||||||
} catch {
|
if (parsed.version) return parsed.version;
|
||||||
// try next candidate
|
} catch {
|
||||||
}
|
// try next candidate
|
||||||
}
|
}
|
||||||
} catch {
|
|
||||||
// fall through
|
|
||||||
}
|
}
|
||||||
return '0.0.0';
|
return '0.0.0';
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user