tangled
alpha
login
or
join now
timtinkers.online
/
neocities
1
fork
atom
timconspicuous.neocities.org
1
fork
atom
overview
issues
pulls
pipelines
Tangled workflow
timtinkers.online
6 months ago
804f420e
b7488599
+58
-15
4 changed files
expand all
collapse all
unified
split
.gitignore
.tangled
workflow
deploy.yaml
deno.json
deploy.ts
+1
-1
.gitignore
···
1
1
_cache
2
2
public/
3
3
deno.lock
4
4
-
env
4
4
+
.env
+19
.tangled/workflow/deploy.yaml
···
1
1
+
engine: nixery
2
2
+
3
3
+
when:
4
4
+
- event: ["push", "pull_request"]
5
5
+
branch: ["main"]
6
6
+
7
7
+
dependencies:
8
8
+
nixpkgs:
9
9
+
- deno
10
10
+
11
11
+
steps:
12
12
+
# deploy.ts will push the "./public" directory to Neocities
13
13
+
# if you are committing those files, skip the build step
14
14
+
- name: Build step
15
15
+
command: |
16
16
+
deno task build
17
17
+
- name: Deploy to Neocities
18
18
+
command: |
19
19
+
deno run --allow-net --allow-read --allow-env deploy.ts
+7
-14
deno.json
···
1
1
{
2
2
"imports": {
3
3
+
"async-neocities": "npm:async-neocities@^4.1.2",
3
4
"lume/": "https://deno.land/x/lume@v3.0.8/",
4
5
"lume/cms/": "https://cdn.jsdelivr.net/gh/lumeland/cms@0.12.5/",
5
6
"lume/jsx-runtime": "https://deno.land/x/ssx@v0.1.12/jsx-runtime.ts"
···
7
8
"tasks": {
8
9
"lume": "echo \"import 'lume/cli.ts'\" | deno run -A -",
9
10
"build": "deno task lume",
10
10
-
"serve": "deno task lume -s"
11
11
+
"serve": "deno task lume -s",
12
12
+
"deploy": "deno run --allow-net --allow-read --allow-env deploy.ts"
11
13
},
12
14
"compilerOptions": {
13
13
-
"types": [
14
14
-
"lume/types.ts"
15
15
-
],
15
15
+
"types": ["lume/types.ts"],
16
16
"jsx": "react-jsx",
17
17
"jsxImportSource": "lume"
18
18
},
19
19
-
"exclude": [
20
20
-
"./public"
21
21
-
],
19
19
+
"exclude": ["./public"],
22
20
"fmt": {
23
21
"useTabs": true,
24
22
"indentWidth": 4
25
23
},
26
26
-
"unstable": [
27
27
-
"temporal",
28
28
-
"fmt-component"
29
29
-
],
24
24
+
"unstable": ["temporal", "fmt-component"],
30
25
"lint": {
31
31
-
"plugins": [
32
32
-
"https://deno.land/x/lume@v3.0.8/lint.ts"
33
33
-
]
26
26
+
"plugins": ["https://deno.land/x/lume@v3.0.8/lint.ts"]
34
27
}
35
28
}
+31
deploy.ts
···
1
1
+
// Helper script to deploy the files to Neocities
2
2
+
import { NeocitiesAPIClient } from "npm:async-neocities";
3
3
+
import { load } from "jsr:@std/dotenv";
4
4
+
5
5
+
await load({ export: true });
6
6
+
7
7
+
// Get credentials from environment
8
8
+
const siteName = Deno.env.get("NEOCITIES_SITE_NAME");
9
9
+
const password = Deno.env.get("NEOCITIES_PASSWORD");
10
10
+
11
11
+
if (!siteName || !password) {
12
12
+
throw new Error(
13
13
+
"Please set NEOCITIES_SITE_NAME and NEOCITIES_PASSWORD environment variables.",
14
14
+
);
15
15
+
}
16
16
+
17
17
+
const apiKeyResponse = await NeocitiesAPIClient.getKey({
18
18
+
siteName: siteName,
19
19
+
ownerPassword: [password],
20
20
+
});
21
21
+
22
22
+
const client = new NeocitiesAPIClient(apiKeyResponse.api_key);
23
23
+
24
24
+
// Deploy the site
25
25
+
await client.deploy({
26
26
+
directory: "./public",
27
27
+
cleanup: true, // Delete orphaned files
28
28
+
includeUnsupportedFiles: false, // Upload unsupported files (paid feature)
29
29
+
});
30
30
+
31
31
+
console.log("Successfully deployed to Neocities!");