generated from CubeCraft-Creations/Tracehound
Dev #26
@@ -9,6 +9,9 @@ import { createHash } from 'node:crypto';
|
|||||||
|
|
||||||
const { TOKEN, SERVER, REPO, SHA } = process.env;
|
const { TOKEN, SERVER, REPO, SHA } = process.env;
|
||||||
const BIN = 'remoterig';
|
const BIN = 'remoterig';
|
||||||
|
// Rolling release tag. NOT "dev" — that would collide with the dev branch
|
||||||
|
// and make refs ambiguous (git push/checkout dev breaks).
|
||||||
|
const TAG = 'dev-latest';
|
||||||
const VERSION = SHA.slice(0, 8);
|
const VERSION = SHA.slice(0, 8);
|
||||||
const API = `${SERVER}/api/v1/repos/${REPO}`;
|
const API = `${SERVER}/api/v1/repos/${REPO}`;
|
||||||
const H = { Authorization: `token ${TOKEN}` };
|
const H = { Authorization: `token ${TOKEN}` };
|
||||||
@@ -27,21 +30,21 @@ const files = {
|
|||||||
'version.txt': Buffer.from(VERSION + '\n'),
|
'version.txt': Buffer.from(VERSION + '\n'),
|
||||||
};
|
};
|
||||||
|
|
||||||
// Roll the "dev" release forward to this commit: delete the old release + tag.
|
// Roll the release forward to this commit: delete the old release + tag.
|
||||||
const existing = await fetch(`${API}/releases/tags/dev`, { headers: H });
|
const existing = await fetch(`${API}/releases/tags/${TAG}`, { headers: H });
|
||||||
if (existing.ok) {
|
if (existing.ok) {
|
||||||
const rel = await existing.json();
|
const rel = await existing.json();
|
||||||
await fetch(`${API}/releases/${rel.id}`, { method: 'DELETE', headers: H });
|
await fetch(`${API}/releases/${rel.id}`, { method: 'DELETE', headers: H });
|
||||||
}
|
}
|
||||||
await fetch(`${API}/tags/dev`, { method: 'DELETE', headers: H }); // ignore if absent
|
await fetch(`${API}/tags/${TAG}`, { method: 'DELETE', headers: H }); // ignore if absent
|
||||||
|
|
||||||
const rel = await ok(await fetch(`${API}/releases`, {
|
const rel = await ok(await fetch(`${API}/releases`, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: { ...H, 'Content-Type': 'application/json' },
|
headers: { ...H, 'Content-Type': 'application/json' },
|
||||||
body: JSON.stringify({
|
body: JSON.stringify({
|
||||||
tag_name: 'dev',
|
tag_name: TAG,
|
||||||
target_commitish: SHA,
|
target_commitish: SHA,
|
||||||
name: `dev (${VERSION})`,
|
name: `${TAG} (${VERSION})`,
|
||||||
body: `Rolling dev build ${SHA}`,
|
body: `Rolling dev build ${SHA}`,
|
||||||
prerelease: true,
|
prerelease: true,
|
||||||
}),
|
}),
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ REPO="${REPO:-CubeCraft-Creations/remote-rig}"
|
|||||||
DEPLOY_DIR="/opt/remoterig"
|
DEPLOY_DIR="/opt/remoterig"
|
||||||
DEPLOY_PATH="${DEPLOY_PATH:-$DEPLOY_DIR/remoterig}"
|
DEPLOY_PATH="${DEPLOY_PATH:-$DEPLOY_DIR/remoterig}"
|
||||||
SERVICE="${SERVICE:-remoterig}"
|
SERVICE="${SERVICE:-remoterig}"
|
||||||
TAG="dev"
|
TAG="dev-latest"
|
||||||
DL="$GITEA_BASE/$REPO/releases/download/$TAG"
|
DL="$GITEA_BASE/$REPO/releases/download/$TAG"
|
||||||
VERSION_FILE="$DEPLOY_DIR/VERSION"
|
VERSION_FILE="$DEPLOY_DIR/VERSION"
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user