Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
81 changes: 0 additions & 81 deletions .github/workflows/changesets-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,84 +72,3 @@ jobs:
-f body="$ENHANCED_BODY"
fi
fi

update-lockfile:
name: Update lockfile on release PR
runs-on: ubuntu-latest
needs: release-pr
permissions:
contents: write
steps:
- name: Checkout release branch
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
ref: changeset-release/main

- name: Setup pnpm
uses: pnpm/action-setup@fc06bc1257f339d1d5d8b3a19a8cae5388b55320 # v5.0.0
with:
version: 10.33.2

- name: Setup node
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
with:
node-version: 20.20.0

- name: Install and update lockfile
run: pnpm install --no-frozen-lockfile

- name: Clean up consumed .server-changes/ files
run: |
set -e
shopt -s nullglob
files=(.server-changes/*.md)
for f in "${files[@]}"; do
if [ "$(basename "$f")" != "README.md" ]; then
git rm --ignore-unmatch "$f"
fi
done

- name: Commit and push lockfile + server-changes cleanup
run: |
set -e
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add pnpm-lock.yaml
if ! git diff --cached --quiet; then
git commit -m "chore: update lockfile and clean up .server-changes/ for release"
git push origin changeset-release/main
else
echo "No changes to commit"
fi

bump-chart-version:
name: Bump Helm chart version on release PR
runs-on: ubuntu-latest
needs: update-lockfile
permissions:
contents: write
steps:
- name: Checkout release branch
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
ref: changeset-release/main

- name: Bump Chart.yaml
run: |
set -e
VERSION=$(jq -r '.version' packages/cli-v3/package.json)
sed -i "s/^version:.*/version: ${VERSION}/" ./hosting/k8s/helm/Chart.yaml
sed -i "s/^appVersion:.*/appVersion: v${VERSION}/" ./hosting/k8s/helm/Chart.yaml

- name: Commit and push Chart.yaml bump
run: |
set -e
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add hosting/k8s/helm/Chart.yaml
if ! git diff --cached --quiet; then
git commit -m "chore: bump helm chart version for release"
git push origin changeset-release/main
else
echo "Chart.yaml already at target version, no-op"
fi
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
"setup": "turbo run generate db:migrate:force db:seed",
"env:pull": "turbo run env:pull",
"changeset:add": "changeset",
"changeset:version": "changeset version",
"changeset:version": "changeset version && pnpm install --lockfile-only && node scripts/bump-helm-chart.mjs && node scripts/cleanup-server-changes.mjs",
"changeset:release": "pnpm run build --filter \"@trigger.dev/*\" --filter \"trigger.dev\" && changeset publish",
"changeset:v4": "changeset pre enter v4",
"changeset:normal": "changeset pre exit",
Expand Down
31 changes: 31 additions & 0 deletions scripts/bump-helm-chart.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import { readFileSync, writeFileSync } from "node:fs";

const VERSION_SOURCE = "packages/cli-v3/package.json";
const CHART_PATH = "hosting/k8s/helm/Chart.yaml";

const { version } = JSON.parse(readFileSync(VERSION_SOURCE, "utf8"));
const desiredVersion = `version: ${version}`;
const desiredAppVersion = `appVersion: v${version}`;

const original = readFileSync(CHART_PATH, "utf8");

const versionMatch = original.match(/^version:.*$/m);
const appVersionMatch = original.match(/^appVersion:.*$/m);

if (!versionMatch || !appVersionMatch) {
const missing = [!versionMatch && "version:", !appVersionMatch && "appVersion:"]
.filter(Boolean)
.join(", ");
console.error(`${CHART_PATH} is missing required key(s): ${missing}`);
process.exit(1);
}

if (versionMatch[0] === desiredVersion && appVersionMatch[0] === desiredAppVersion) {
console.log(`${CHART_PATH} already at ${version} (from ${VERSION_SOURCE}), no changes`);
} else {
const updated = original
.replace(/^version:.*/m, desiredVersion)
.replace(/^appVersion:.*/m, desiredAppVersion);
writeFileSync(CHART_PATH, updated);
console.log(`${CHART_PATH} bumped to ${version} (from ${VERSION_SOURCE})`);
}
18 changes: 18 additions & 0 deletions scripts/cleanup-server-changes.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { readdirSync, unlinkSync } from "node:fs";

const DIR = ".server-changes";
const KEEP = new Set(["README.md"]);

const removed = [];
for (const file of readdirSync(DIR)) {
if (!file.endsWith(".md") || KEEP.has(file)) continue;
unlinkSync(`${DIR}/${file}`);
removed.push(file);
}

if (removed.length === 0) {
console.log(`${DIR} already clean, no changes`);
} else {
console.log(`${DIR} cleaned, removed ${removed.length} consumed file(s):`);
removed.forEach((f) => console.log(` - ${f}`));
}
Loading