Skip to content

Commit f531446

Browse files
committed
Add github actions support
1 parent 575041c commit f531446

8 files changed

Lines changed: 277 additions & 190 deletions

File tree

Cargo.lock

Lines changed: 25 additions & 25 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Dockerfile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,6 @@ RUN cargo install --path ./cli --locked
1414

1515
FROM alpine:latest
1616
COPY --from=builder /usr/local/cargo/bin/luna_cli /usr/local/bin/luna_cli
17-
ENTRYPOINT ["luna_cli"]
17+
COPY cli/entrypoint.sh /entrypoint.sh
18+
RUN chmod +x /entrypoint.sh
19+
ENTRYPOINT ["/entrypoint.sh"]

README.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ Current todos:
5151
- [ ] Implement a bundling system to host assets in the docs
5252
- [ ] Avatars
5353
- [ ] Asset items
54+
- [x] Filtering
5455
- [ ] Sorting
5556
- [ ] More customization options
5657
- [ ] Custom templates
@@ -62,6 +63,22 @@ Current todos:
6263

6364
---
6465

66+
## GitHub Actions
67+
68+
You can use Luna in your GitHub Actions workflow to generate your site.
69+
70+
```yaml
71+
steps:
72+
- uses: actions/checkout@v4
73+
- uses: LinwoodDev/Luna@develop
74+
with:
75+
command: 'build'
76+
path: 'output/docs'
77+
index_path: 'output/index.json'
78+
```
79+
80+
If you only want to generate the index or docs separately, you can use the `generate` or `docs` commands.
81+
6582
## Contributing
6683

6784
We are happy to see that you are interested in contributing to Luna.

action.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: 'Luna CLI'
2+
description: 'Luna is a build system to enable hosting a static library system for assets.'
3+
author: 'LinwoodCloud'
4+
branding:
5+
icon: 'package'
6+
color: 'green'
7+
inputs:
8+
command:
9+
description: 'Command to run (generate, docs, build, index, get)'
10+
required: false
11+
default: 'generate'
12+
path:
13+
description: 'Output path (for generate/docs/build) or input path (for index)'
14+
required: false
15+
index_path:
16+
description: 'Input index path (only for docs command)'
17+
required: false
18+
page_size:
19+
description: 'Page size (only for docs command)'
20+
required: false
21+
args:
22+
description: 'Raw arguments to pass to the CLI (overrides other inputs)'
23+
required: false
24+
runs:
25+
using: 'docker'
26+
image: 'Dockerfile'

cli/entrypoint.sh

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
#!/bin/sh -l
2+
3+
# If args input is provided, use it directly
4+
if [ -n "$INPUT_ARGS" ]; then
5+
exec luna_cli $INPUT_ARGS
6+
fi
7+
8+
COMMAND="${INPUT_COMMAND:-generate}"
9+
CMD="luna_cli $COMMAND"
10+
11+
if [ "$COMMAND" = "generate" ]; then
12+
if [ -n "$INPUT_PATH" ]; then
13+
CMD="$CMD $INPUT_PATH"
14+
fi
15+
elif [ "$COMMAND" = "docs" ]; then
16+
PATH_VAL="${INPUT_PATH:-output/docs}"
17+
# If index path is set, we must provide path
18+
if [ -n "$INPUT_INDEX_PATH" ]; then
19+
CMD="$CMD $PATH_VAL $INPUT_INDEX_PATH"
20+
elif [ -n "$INPUT_PATH" ]; then
21+
# If only path is set
22+
CMD="$CMD $INPUT_PATH"
23+
fi
24+
25+
if [ -n "$INPUT_PAGE_SIZE" ]; then
26+
CMD="$CMD --page-size $INPUT_PAGE_SIZE"
27+
fi
28+
elif [ "$COMMAND" = "build" ]; then
29+
INDEX_PATH="${INPUT_INDEX_PATH:-output/index.json}"
30+
DOCS_PATH="${INPUT_PATH:-output/docs}"
31+
32+
echo "Running: luna_cli generate $INDEX_PATH"
33+
luna_cli generate "$INDEX_PATH" || exit 1
34+
35+
CMD="luna_cli docs $DOCS_PATH $INDEX_PATH"
36+
if [ -n "$INPUT_PAGE_SIZE" ]; then
37+
CMD="$CMD --page-size $INPUT_PAGE_SIZE"
38+
fi
39+
fi
40+
41+
echo "Running: $CMD"
42+
exec $CMD

cli/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"keywords": [],
1010
"author": "",
1111
"license": "ISC",
12-
"packageManager": "pnpm@10.26.0",
12+
"packageManager": "pnpm@10.27.0",
1313
"dependencies": {
1414
"@linwooddev/style": "^0.4.2"
1515
}

docs/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@
2323
"remark-heading-id": "^1.0.1",
2424
"typescript": "^5.9.3"
2525
},
26-
"packageManager": "pnpm@10.26.0",
26+
"packageManager": "pnpm@10.27.0",
2727
"devDependencies": {
2828
"@vite-pwa/astro": "^1.2.0",
29-
"sass": "^1.97.0",
29+
"sass": "^1.97.1",
3030
"sharp": "^0.34.5",
3131
"vite-plugin-pwa": "^1.2.0",
3232
"workbox-window": "^7.4.0"

0 commit comments

Comments
 (0)