Commit 4948b38
committed
feat(deploy-val): auto-discover val/*.ts + deploy receipt + GH workflow
Automates val-to-Val-Town deploys on every push to main touching
val/**, with secret hygiene.
scripts/walkthrough.mts (deployVal):
- Replace hardcoded files manifest with readdirSync(val/). Filesystem
is the source of truth — no more drift when splitting files.
Skips *.test.ts. Sorts alphabetically for deterministic logs.
- Require val/index.ts presence (fails fast otherwise).
- Compute sha256 of each uploaded file, record in a receipt row
(path, type, action, bytes, sha256).
- printDeployReceipt() writes a markdown table to stdout + to
$GITHUB_STEP_SUMMARY when running under Actions. The workflow run
page now shows exactly what shipped, with content hashes that
round-trip against Val Town's stored state.
.github/workflows/deploy-val.yml:
- Triggers: push to main with path filter (val/**, deploy-val.yml,
scripts/walkthrough.mts, scripts/audit-deps.mts, package.json,
pnpm-lock.yaml) + workflow_dispatch.
- No pull_request trigger — fork PRs never see the VALTOWN_TOKEN
secret (GitHub blocks it, but belt-and-suspenders).
- Job-level `env: VALTOWN_TOKEN: ${{ secrets.VALTOWN_TOKEN }}` so
only this job sees the token; workflow-level stays read-only.
- Preflight step fails fast with a clear error if VALTOWN_TOKEN
is missing — no wasted install time on a misconfigured repo.
- Concurrency group=deploy-val, cancel-in-progress=false — partial
uploads leave inconsistent state; queue instead.
- Uses SocketDev/socket-registry setup-and-install for toolchain
parity with CI + Pages workflows.
- Header comment documents the one-time token-setup flow so a
future contributor can set this up without institutional knowledge.
Val Town env vars (JWT_SIGNING_KEY, ALLOWED_*, etc.) are intentionally
NOT passed from the workflow — the env-var update loop `continue`s on
missing values, so CI deploys only touch code, never env config. Env
vars stay managed via the Val Town UI.
Also confirmed the auto-injected `valtown` env var on Val Town is a
platform-provided short-lived token for stdlib auth (sqlite, email,
etc.) — not something we set or should remove.1 parent 3bf6eaf commit 4948b38
2 files changed
Lines changed: 197 additions & 41 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
882 | 882 | | |
883 | 883 | | |
884 | 884 | | |
| 885 | + | |
| 886 | + | |
| 887 | + | |
| 888 | + | |
| 889 | + | |
| 890 | + | |
| 891 | + | |
| 892 | + | |
| 893 | + | |
| 894 | + | |
| 895 | + | |
| 896 | + | |
| 897 | + | |
| 898 | + | |
| 899 | + | |
| 900 | + | |
| 901 | + | |
| 902 | + | |
| 903 | + | |
| 904 | + | |
| 905 | + | |
| 906 | + | |
| 907 | + | |
| 908 | + | |
| 909 | + | |
| 910 | + | |
| 911 | + | |
| 912 | + | |
| 913 | + | |
| 914 | + | |
| 915 | + | |
| 916 | + | |
| 917 | + | |
| 918 | + | |
| 919 | + | |
| 920 | + | |
| 921 | + | |
| 922 | + | |
| 923 | + | |
| 924 | + | |
| 925 | + | |
| 926 | + | |
| 927 | + | |
| 928 | + | |
| 929 | + | |
| 930 | + | |
| 931 | + | |
885 | 932 | | |
886 | 933 | | |
887 | 934 | | |
| |||
969 | 1016 | | |
970 | 1017 | | |
971 | 1018 | | |
972 | | - | |
973 | | - | |
974 | | - | |
975 | | - | |
976 | | - | |
977 | | - | |
978 | | - | |
979 | | - | |
980 | | - | |
981 | | - | |
982 | | - | |
983 | | - | |
984 | | - | |
985 | | - | |
986 | | - | |
987 | | - | |
988 | | - | |
989 | | - | |
990 | | - | |
991 | | - | |
992 | | - | |
| 1019 | + | |
| 1020 | + | |
| 1021 | + | |
| 1022 | + | |
| 1023 | + | |
| 1024 | + | |
| 1025 | + | |
| 1026 | + | |
| 1027 | + | |
| 1028 | + | |
| 1029 | + | |
| 1030 | + | |
| 1031 | + | |
| 1032 | + | |
| 1033 | + | |
| 1034 | + | |
| 1035 | + | |
| 1036 | + | |
| 1037 | + | |
| 1038 | + | |
| 1039 | + | |
| 1040 | + | |
| 1041 | + | |
| 1042 | + | |
| 1043 | + | |
| 1044 | + | |
| 1045 | + | |
| 1046 | + | |
| 1047 | + | |
| 1048 | + | |
| 1049 | + | |
993 | 1050 | | |
994 | | - | |
995 | | - | |
996 | | - | |
997 | | - | |
| 1051 | + | |
998 | 1052 | | |
| 1053 | + | |
999 | 1054 | | |
1000 | 1055 | | |
1001 | 1056 | | |
| |||
1005 | 1060 | | |
1006 | 1061 | | |
1007 | 1062 | | |
| 1063 | + | |
1008 | 1064 | | |
1009 | | - | |
1010 | | - | |
1011 | | - | |
1012 | | - | |
1013 | | - | |
| 1065 | + | |
| 1066 | + | |
| 1067 | + | |
| 1068 | + | |
| 1069 | + | |
| 1070 | + | |
| 1071 | + | |
| 1072 | + | |
| 1073 | + | |
| 1074 | + | |
| 1075 | + | |
| 1076 | + | |
| 1077 | + | |
| 1078 | + | |
| 1079 | + | |
1014 | 1080 | | |
1015 | 1081 | | |
1016 | 1082 | | |
1017 | 1083 | | |
1018 | | - | |
1019 | | - | |
1020 | | - | |
1021 | | - | |
1022 | | - | |
| 1084 | + | |
| 1085 | + | |
| 1086 | + | |
| 1087 | + | |
| 1088 | + | |
| 1089 | + | |
1023 | 1090 | | |
1024 | | - | |
1025 | | - | |
1026 | | - | |
1027 | | - | |
1028 | | - | |
1029 | | - | |
| 1091 | + | |
| 1092 | + | |
| 1093 | + | |
1030 | 1094 | | |
1031 | 1095 | | |
| 1096 | + | |
| 1097 | + | |
| 1098 | + | |
| 1099 | + | |
| 1100 | + | |
| 1101 | + | |
1032 | 1102 | | |
1033 | 1103 | | |
1034 | 1104 | | |
| |||
0 commit comments