Skip to content

Commit 3f066d0

Browse files
committed
Fix publish-time standalone Deno checks
1 parent fa5b977 commit 3f066d0

1 file changed

Lines changed: 26 additions & 8 deletions

File tree

.github/workflows/ci.yml

Lines changed: 26 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,22 +26,27 @@ jobs:
2626

2727
# In CI this repo is checked out standalone, without the monorepo parent.
2828
# Moving tsconfig.json aside keeps Deno from picking up TypeScript settings
29-
# that only make sense in the parent-workspace context.
29+
# that only make sense in the parent-workspace context. Move it completely
30+
# out of the repo so publish/check steps do not see a fake *.off file.
3031
- name: Lint (Deno)
3132
run: |
33+
backup_path=''
3234
if [ -f tsconfig.json ]; then
33-
mv tsconfig.json tsconfig.json.off
34-
trap 'mv tsconfig.json.off tsconfig.json' EXIT
35+
backup_path="$(mktemp)"
36+
mv tsconfig.json "$backup_path"
37+
trap 'if [ -n "$backup_path" ] && [ -f "$backup_path" ]; then mv "$backup_path" tsconfig.json; fi' EXIT
3538
fi
3639
deno lint
3740
3841
# Run the cheap Deno checks before the longer Bun tests so failures show up
3942
# earlier in the workflow.
4043
- name: Check (Deno)
4144
run: |
45+
backup_path=''
4246
if [ -f tsconfig.json ]; then
43-
mv tsconfig.json tsconfig.json.off
44-
trap 'mv tsconfig.json.off tsconfig.json' EXIT
47+
backup_path="$(mktemp)"
48+
mv tsconfig.json "$backup_path"
49+
trap 'if [ -n "$backup_path" ] && [ -f "$backup_path" ]; then mv "$backup_path" tsconfig.json; fi' EXIT
4550
fi
4651
deno check
4752
@@ -62,9 +67,15 @@ jobs:
6267
run: bun test examples/runtime-matrix.bun.test.ts --timeout 30000 --max-concurrency 1
6368

6469
# The --allow-dirty is needed because in CI the deno.lock file may be modified.
65-
# Unlike deno lint/check, the dry-run publish doesn't need the tsconfig workaround.
6670
- name: JSR check
67-
run: deno publish --dry-run --allow-dirty
71+
run: |
72+
backup_path=''
73+
if [ -f tsconfig.json ]; then
74+
backup_path="$(mktemp)"
75+
mv tsconfig.json "$backup_path"
76+
trap 'if [ -n "$backup_path" ] && [ -f "$backup_path" ]; then mv "$backup_path" tsconfig.json; fi' EXIT
77+
fi
78+
deno publish --dry-run --allow-dirty
6879
6980
# Only run if we're on main and the test job succeeded:
7081
publish:
@@ -87,4 +98,11 @@ jobs:
8798
run: deno install
8899

89100
- name: "Publish package (if new version exists)"
90-
run: npx jsr publish --allow-dirty
101+
run: |
102+
backup_path=''
103+
if [ -f tsconfig.json ]; then
104+
backup_path="$(mktemp)"
105+
mv tsconfig.json "$backup_path"
106+
trap 'if [ -n "$backup_path" ] && [ -f "$backup_path" ]; then mv "$backup_path" tsconfig.json; fi' EXIT
107+
fi
108+
npx jsr publish --allow-dirty

0 commit comments

Comments
 (0)