Skip to content
Merged
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
36 changes: 36 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,39 @@ jobs:
- run: pnpm install --frozen-lockfile

- run: pnpm check && pnpm lint && pnpm test && pnpm compile linux-x64

publish:
needs: [deliverables, check]
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@v4

- uses: pnpm/action-setup@v4
with:
version: 10

- uses: actions/setup-node@v4
with:
node-version: 22
registry-url: https://registry.npmjs.org
cache: pnpm

- run: pnpm install --frozen-lockfile

- name: Publish this version when npm does not have it
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH }}
run: |
set -euo pipefail
name=$(node -p "require('./package.json').name")
version=$(node -p "require('./package.json').version")
if npm view "${name}@${version}" version >/dev/null 2>&1; then

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Medium · Registry errors look like missing versions

When the npm lookup fails for a reason other than the version being absent while that version is already published, the publish step treats every npm view failure as an absent version and proceeds to publish. If the version already exists but the lookup fails transiently, npm publish reports a version conflict and the CI job fails instead of skipping the existing version.

Distinguish registry not-found responses from other lookup errors, and retry or fail with the lookup error before publishing.

Prompt for AI agents
In `.github/workflows/ci.yml` at line 61:

**Registry errors look like missing versions**

When the npm lookup fails for a reason other than the version being absent while that version is already published, the publish step treats every `npm view` failure as an absent version and proceeds to publish. If the version already exists but the lookup fails transiently, `npm publish` reports a version conflict and the CI job fails instead of skipping the existing version.

Distinguish registry not-found responses from other lookup errors, and retry or fail with the lookup error before publishing.

echo "${name}@${version} is already on npm."
echo "Bump package.json in the merged pull request to publish a new version."
exit 0
fi
npm publish --access public
echo "published ${name}@${version}"
13 changes: 9 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,12 @@ federation exposes and the absence of bundled host-singleton fallbacks.
Platform cases also execute generated authorization/pagination regressions
without starting databases. This is not a full live erxes deployment test.

Push a `vX.Y.Z` tag: `.github/workflows/release.yml` compiles every target,
packs `dist/release/` archives plus `SHA256SUMS`, and publishes a GitHub
release. A `workflow_dispatch` run exercises the same pipeline without
publishing.
Merging to `main` publishes `@erxes/create-plugin` from CI. Bump
`package.json` in that pull request. If that exact version is already on
npm, the workflow leaves it there. No local `npm publish` and no one-time
password are required.

Push a `vX.Y.Z` tag when you also want the standalone binary GitHub release.
`.github/workflows/release.yml` compiles every target, packs `dist/release/`
archives plus `SHA256SUMS`, and publishes that GitHub release. A
`workflow_dispatch` run exercises the same pipeline without publishing.
3 changes: 3 additions & 0 deletions src/generated.ts
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,9 @@ export const createPackageManagerFiles = (o: ProjectOptions): Record<string, str
".yarnrc.yml": `${JSON.stringify(
{
nodeLinker: "node-modules",
// Yarn otherwise turns CI=true into an immutable install and
// refuses to create the first yarn.lock.
enableImmutableInstalls: false,
packageExtensions: {
...YARN_UI_EXTENSIONS,
...(o.backend === "platform" ? YARN_PLATFORM_EXTENSIONS : {}),
Expand Down
4 changes: 4 additions & 0 deletions test/scaffold.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,10 @@ for (const pm of PACKAGE_MANAGERS) {
"packages:\n - api\n - ui\n",
);
}
if (pm === "yarn") {
const yarnrc = await readFile(join(dir, ".yarnrc.yml"), "utf8");
assert.match(yarnrc, /"enableImmutableInstalls": false/);
}
});

it("automatically keeps transitive React peers on the host's React 18 cohort", async () => {
Expand Down
Loading