Skip to content

Commit

Permalink
chore: @fuel-ts/recipes now correctly bumped on release (#3685)
Browse files Browse the repository at this point in the history
* chore: fix recipe version bumping in CI

* changeset

* Update .changeset/empty-pigs-talk.md

* chore: ensure paths exist
  • Loading branch information
petertonysmith94 authored Feb 10, 2025
1 parent 6f32228 commit 5b7a38e
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 5 deletions.
4 changes: 4 additions & 0 deletions .changeset/empty-pigs-talk.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
---

chore: `@fuel-ts/recipes` now correctly bumped on release
20 changes: 15 additions & 5 deletions scripts/changeset/changeset-version-with-docs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import { execSync } from 'child_process';
import { error } from 'console';
import { existsSync } from 'fs';

(() => {
try {
Expand All @@ -23,25 +24,34 @@ import { error } from 'console';
*/
execSync(`pnpm -C packages/versions build`);

// Invoke fuels' build:proxy script (will rewrite header versions in generated files)
execSync(`pnpm -C packages/fuels build:proxy`);
// Invoke recipes build script (will rewrite header versions in generated files)
execSync(`pnpm -C packages/recipes build`);

// Checks if the commands above generated git changes
const versionsFilePath = `packages/versions/src/lib/getBuiltinVersions.ts`;
const proxyDirPath = `packages/fuels/src/cli/commands/deploy/proxy`;
const recipeDirPath = `packages/recipes/src`;

// Ensure paths exist
const paths = [versionsFilePath, recipeDirPath];
if (!paths.every(existsSync)) {
throw new Error(
`Paths do not exist: ${paths.filter((path) => !existsSync(path)).join(', ')}`
);
}

const versionsChanged = !!execSync(`git status --porcelain ${versionsFilePath}`)
.toString()
.trim();

const proxyChanged = !!execSync(`git status --porcelain ${proxyDirPath}`).toString().trim();
const proxyChanged = !!execSync(`git status --porcelain ${recipeDirPath}`).toString().trim();

// If they did, add and commit the changes
if (versionsChanged || proxyChanged) {
execSync(`git add ${versionsFilePath} ${proxyDirPath}`);
execSync(`git add ${versionsFilePath} ${recipeDirPath}`);
execSync(`git commit -m"ci(scripts): update versions"`);
}
} catch (err) {
error(err.toString());
process.exit(1);
}
})();

0 comments on commit 5b7a38e

Please sign in to comment.