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
7 changes: 6 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,9 @@ jobs:
# npm: de eerste keer met het geheim NPM_TOKEN, daarna via trusted publishing
# (npmjs.com → pakket projectx-ui → Settings → Trusted Publisher: GitHub Actions,
# DafkeDD / ProjectX-UI / release.yml). Dan mag NPM_TOKEN weg. Zie README.
# Draait ook als de GitHub-release al bestaat: mislukte npm-publicatie wordt zo bij
# de volgende push naar main (of via "Run workflow") alsnog ingehaald.
- name: CLI op npm publiceren
if: steps.version.outputs.exists == 'false'
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
TAG_VERSION: ${{ steps.version.outputs.tag }}
Expand All @@ -97,6 +98,10 @@ jobs:
exit 0
fi
# Trusted publishing heeft npm 11.5.1 of nieuwer nodig.
if [ ! -f "$PAKKET" ]; then
rm -rf packages/cli/registry && cp -r registry packages/cli/registry
(cd packages/cli && npm pack --pack-destination ../..)
fi
npm install -g npm@11 --no-fund --no-audit
if [ -n "$NPM_TOKEN" ]; then
echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > "$HOME/.npmrc"
Expand Down
8 changes: 8 additions & 0 deletions tests/cli/npm-pakket.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,4 +73,12 @@ describe("npm-pakket projectx-ui", () => {
expect(workflow).toContain('npm view "projectx-ui@$VERSION" version');
expect(workflow).toContain("NPM_TOKEN: ${{ secrets.NPM_TOKEN }}");
});

it("de npm-stap hangt niet af van een nieuwe tag, zodat een mislukte publicatie ingehaald wordt", () => {
const workflow = readFileSync(join(root, ".github/workflows/release.yml"), "utf8");
const stap = workflow.slice(workflow.indexOf("- name: CLI op npm publiceren"));
expect(stap.split("run: |")[0]).not.toContain("if:");
// Bestaat de release al, dan is er nog geen pakket: de stap maakt het zelf.
expect(stap).toContain("npm pack --pack-destination ../..");
});
});