Skip to content

Commit 353607a

Browse files
authored
build: add package (#30)
1 parent 90bc4df commit 353607a

6 files changed

Lines changed: 125 additions & 14 deletions

File tree

.github/workflows/deploy.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
runs-on: ubuntu-latest
2121
steps:
2222
- name: Checkout repository
23-
uses: actions/checkout@v5
23+
uses: actions/checkout@v6
2424

2525
- name: Install Nix
2626
uses: cachix/install-nix-action@v31

.github/workflows/release.yaml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*.*.*'
7+
8+
permissions:
9+
contents: write
10+
11+
jobs:
12+
release:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Checkout repository
16+
uses: actions/checkout@v6
17+
18+
- name: Install Nix
19+
uses: cachix/install-nix-action@v31
20+
with:
21+
nix_path: nixpkgs=channel:nixos-25.11
22+
23+
- name: Build project
24+
run: |
25+
nix develop --command uv build
26+
27+
- name: Create Release
28+
uses: softprops/action-gh-release@v2
29+
with:
30+
generate_release_notes: true
31+
files: |
32+
dist/stepcode-*

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ __pycache__/
1313
.pytest_cache/
1414
.ruff_cache/
1515
.mypy_cache/
16+
stepcode.egg-info/
1617

1718
# ---
1819
dist/

docs/contribute/build.md

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,28 @@
11
---
2-
title: 'How to build'
2+
title: 'How to build stepcode and the documentation'
33
---
44

55
# {{title}}
66

77
## Building stepcode
88

9+
To build **stepcode** into source and binary distributions compatible with, for example, PyPI, you can use the following command:
10+
11+
```sh
12+
uv build
13+
```
14+
915
## Building our documentation
16+
17+
To build the documentation, you can use:
18+
19+
```sh
20+
uv run src/main.py docs
21+
```
22+
23+
## Using nix
24+
If you are a [nix](https://nixos.org/) user, you can use the `devShell` provided by the `flake.nix` to easily set up a development environment with all the necessary dependencies. To enter the development shell, run:
25+
26+
```sh
27+
nix develop .
28+
```

docs/usage/book.md

Lines changed: 71 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,77 @@ title: 'Create your own book'
44

55
# {{title}}
66

7-
## How to create your own book
7+
Creating a static book with **stepcode** is as simple as writing standard Markdown.
88

9-
## How to deploy
9+
## Cloning the Repository
10+
11+
As **stepcode** is made in Python, you must clone the repository and install the dependencies to use it. You can do this with the following commands:
12+
13+
```sh
14+
git clone
15+
cd stepcode
16+
```
17+
18+
To easily manage dependencies and virtual environments, we recommend using [uv](https://docs.astral.sh/uv/). To install the dependencies and run the project, use:
19+
20+
```sh
21+
uv sync
22+
uv run src/main.py
23+
```
24+
25+
## Creating Your Book
26+
27+
To create your book, create a folder. There you must have a `stepcode.toml`:
28+
29+
```toml
30+
[book]
31+
name = "My book"
32+
author = "Me of course"
33+
34+
chapters = [
35+
# here you must list all the chapters of your book, in order.
36+
"blog/first-post.md",
37+
"blog/second-post.md",
38+
39+
"cooking/first-recipe.md",
40+
]
41+
```
42+
43+
and a index.md in the root of the folder:
44+
45+
```markdown
46+
---
47+
title: 'My book'
48+
---
49+
50+
# {{title}}
51+
52+
Hi
53+
```
54+
55+
### If you are a [nix](https://nixos.org/download/) user, the repo flake exposes a `devShell` to download all the dependencies and have a ready to use environment. You can enter it with:
56+
57+
```sh
58+
nix develop .
59+
```
60+
61+
Furthermore, a template book is available using:
62+
63+
```sh
64+
nix flake new --template github:daniqss/stepcode#book my-book
65+
```
66+
67+
## Building the Book
68+
69+
Instructions on how to build and host your book can be found in the [README.md](https://github.com/daniqss/stepcode?tab=readme-ov-file#usage) of the repository.
70+
71+
After using
72+
73+
```sh
74+
uv run src/main.py <YOUR_FOLDER>
75+
```
1076

1177
### In Github Pages
78+
79+
If you want to host your book on Github Pages, you can copy our [workflow](https://github.com/daniqss/stepcode/blob/main/.github/workflows/release.yaml)
80+
If you're using the template, it already contains a workflow that will automatically build and deploy your book to Github Pages on every push to the `main` branch. You can customize it as you wish, but make sure to update the path to the book in the workflow.

docs/usage/stepcode.md

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,6 @@ title: 'How to use stepcode'
44

55
# {{title}}
66

7-
Creating a static book with **stepcode** is as simple as writing standard Markdown.
8-
9-
## Creating Chapters
10-
11-
To add a new chapter, simply create a `.md` file in the `content/chapters/` directory. The tool will automatically detect it and generate the corresponding HTML.
12-
137
## Writing Pseudocode
148

159
To enable step-by-step execution for your pseudocode, wrap your code blocks with the `stepcode` language identifier:
@@ -23,7 +17,3 @@ result := x + y
2317
````
2418

2519
The interpreter will parse these blocks and provide the interactive stepping functionality in the generated static site.
26-
27-
## Building the Book
28-
29-
Instructions on how to build and host your book can be found in the [README.md](https://github.com/daniqss/stepcode) of the repository.

0 commit comments

Comments
 (0)