diff --git a/.github/workflows/publish-github-pages.yml b/.github/workflows/publish-github-pages.yml new file mode 100644 index 00000000..17f6c68d --- /dev/null +++ b/.github/workflows/publish-github-pages.yml @@ -0,0 +1,48 @@ +name: Publish Github Pages +on: + push: + branches: [main] + +jobs: + # Build job + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + + - name: Setup Zig + uses: mlugg/setup-zig@v1 + with: + version: 0.13.0 + + - name: Build + run: zig build + + - name: Upload Artifact + uses: actions/upload-pages-artifact + id: deployment + with: + path: zig-out/www + + + # Deploy job + deploy: + # Add a dependency to the build job + needs: build + + # Grant GITHUB_TOKEN the permissions required to make a Pages deployment + permissions: + pages: write # to deploy to Pages + id-token: write # to verify the deployment originates from an appropriate source + + # Deploy to the github-pages environment + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + + # Specify runner + deployment step + runs-on: ubuntu-latest + steps: + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v4 # or specific "vX.X.X" version tag for this action diff --git a/build.zig b/build.zig index ae7d5ab2..da0b3ee5 100644 --- a/build.zig +++ b/build.zig @@ -47,14 +47,6 @@ pub fn build(b: *Build) void { const package_step = b.step("package", "Package monorepo using boxzer"); package_step.dependOn(&boxzer_run.step); - //const website_dep = b.dependency("website", .{}); - //const website_step = b.step("website", "Build website"); - //website_step.dependOn(website_dep.builder.getInstallStep()); - - const parts_db = generate_parts_db(b) catch @panic("OOM"); - const parts_db_json = b.addInstallFile(parts_db, "parts-db.json"); - package_step.dependOn(&parts_db_json.step); - const test_ports_step = b.step("run-port-tests", "Run all platform agnostic tests for Ports"); inline for (ports) |port| { const port_dep = b.dependency(port[0], .{}); @@ -63,87 +55,3 @@ pub fn build(b: *Build) void { } } } - -const PartsDb = struct { - chips: []const Chip, - boards: []const Board, - - const Chip = struct { - identifier: []const u8, - port_package: []const u8, - url: ?[]const u8, - cpu: []const u8, - has_hal: bool, - memory: struct { - flash: u64, - ram: u64, - }, - output_format: ?[]const u8, - }; - const Board = struct { - identifier: []const u8, - port_package: []const u8, - chip_idx: u32, - url: ?[]const u8, - output_format: ?[]const u8, - }; -}; - -fn generate_parts_db(b: *Build) !Build.LazyPath { - var chips = std.ArrayList(PartsDb.Chip).init(b.allocator); - var boards = std.ArrayList(PartsDb.Board).init(b.allocator); - - @setEvalBranchQuota(20000); - inline for (ports) |port| { - const chips_start_idx = chips.items.len; - inline for (@typeInfo(@field(port[1], "chips")).Struct.decls) |decl| { - if (@typeInfo(@TypeOf(@field(@field(port[1], "chips"), decl.name))) != .Struct) - continue; - - const target = @field(@field(port[1], "chips"), decl.name); - try chips.append(.{ - .identifier = decl.name, - .port_package = port[0], - .url = target.chip.url, - .cpu = target.chip.cpu.name, - .has_hal = target.hal != null, - .memory = .{ - .flash = 0, - .ram = 0, - }, - .output_format = null, - }); - } - - inline for (@typeInfo(@field(port[1], "boards")).Struct.decls) |decl| { - const target = @field(@field(port[1], "boards"), decl.name); - _ = target; - _ = chips_start_idx; - - //const chip_idx = inline for (@typeInfo(@field(port[1], "chips")).Struct.decls, 0..) |chip_decl, idx| { - // const chip = @field(@field(port[1], "chips"), chip_decl.name); - // if (std.mem.eql(u8, chip.chip.name, target.chip.name)) - // break chips_start_idx + idx; - //} else @compileError("failed to get chip_idx"); - - try boards.append(.{ - .identifier = decl.name, - .port_package = port[0], - .chip_idx = 0, - .url = "", - .output_format = null, - }); - } - } - - const parts_db = PartsDb{ - .chips = chips.items, - .boards = boards.items, - }; - - const parts_db_str = try std.json.stringifyAlloc(b.allocator, parts_db, .{ - .whitespace = .indent_4, - }); - const write_file_step = b.addWriteFiles(); - return write_file_step.add("parts-db.json", parts_db_str); -} diff --git a/website/README.md b/website/README.md index 36491367..f481d026 100644 --- a/website/README.md +++ b/website/README.md @@ -1,34 +1,3 @@ # Zig Embedded Group - Website and Articles This project both contains the contents and the generation of the ZEG website. - -## Folder Structure - -``` -. -├── build.zig -├── deps Contains submodule dependencies -│ └── … -├── LICENCE -├── README.md -├── render Not included in the repo, will contain the rendered website -│ └── … -├── src Source of the website generator and other tools -│ └── main.zig -└── website Contains the raw input data for the website - ├── articles Contains all articles in the format `YYYY-MM-dd - ${TITLE}.md` - │ └── … - ├── img Contains the images used on the website. - │ └── … - ├── index.md Index page of the website - └── tutorials Contains the raw tutorial files - └── … -``` - -## Markdown - -The website uses basic markdown that allows GFM style tables and also supports *some* placeholders: - -- `` will insert a table of contents if alone in a single line. The ToC will be rendered in the same depth as the next heading, so everything higher in the hierarchy will be ignored. -- `` renders a list of all available articles -- `` renders a list of the 10 latest articles diff --git a/website/WIP.md b/website/WIP.md deleted file mode 100644 index 1f26e46e..00000000 --- a/website/WIP.md +++ /dev/null @@ -1,42 +0,0 @@ -# Planned/TODO articles - -## Work in progress - -These have either incomplete content on the website or a branch where they are being written. - -- Tutorials - - 01-embedded-basics - - 02-embedded-programming -- Articles - - NONE - -## TODO - -Things that should be written eventually. - -- Tutorials - - Getting started with: - - Arduino/AVR - - LPC1768 - - NRF52 - - Hardware: nRF52840 Dongle - - https://www.nordicsemi.com/Software-and-tools/Development-Kits/nRF52840-Dongle/GetStarted - - https://www.nordicsemi.com/Software-and-Tools/Development-Tools/nRF-Connect-for-desktop - - https://infocenter.nordicsemi.com/index.jsp?topic=%2Fug_nc_programmer%2FUG%2Fnrf_connect_programmer%2Fncp_programming_dongle.html - - Raspberry Pi Pico - - STM32 - - What device to chose? - - Introduction to HAL 9001 -- Articles - - Creating your own JTAG debugger - - Black Magic Probe - - https://paramaggarwal.medium.com/converting-an-stm32f103-board-to-a-black-magic-probe-c013cf2cc38c - - zCOM, a network stack for embedded devices - -## Ideas - -Ideas for things to write that would be great to do eventually or projects to write up about. - -- Tutorials -- Articles - - Make your own keyboard with zig (and replace qmk) diff --git a/website/build.zig b/website/build.zig index ece05371..e86ec6cf 100644 --- a/website/build.zig +++ b/website/build.zig @@ -2,12 +2,12 @@ const std = @import("std"); const zine = @import("zine"); pub fn build(b: *std.Build) void { - // zine.scriptyReferenceDocs(b, "content/documentation/scripty/index.md"); zine.website(b, .{ - .layouts_dir_path = "layouts", - .content_dir_path = "content", - .static_dir_path = "static", - .host_url = "https://microzig.tech", .title = "Zig Embedded Group", + .host_url = "https://ZigEmbeddedGroup/github.io/microzig", + .content_dir_path = "content", + .layouts_dir_path = "layouts", + .assets_dir_path = "assets", + .output_path_prefix = "www", }); } diff --git a/website/build.zig.zon b/website/build.zig.zon index 148e7ac0..fbe9388f 100644 --- a/website/build.zig.zon +++ b/website/build.zig.zon @@ -4,8 +4,8 @@ .paths = .{"."}, .dependencies = .{ .zine = .{ - .url = "git+https://github.com/kristoff-it/zine#e21b179b78de54ab48efe38d2378e87a56cb3542", - .hash = "1220781f118454bbc87d7efbd244b4d1ef029e76a6113ddf4752a6f3cd85879dbb3b", + .url = "git+https://github.com/kristoff-it/zine.git#afebddd2aa1ac284d2d514c7eb5ebf03b01c5678", + .hash = "1220c3950d2e36fe1e64cc6c9694c38f20c54cf82842b0f5a1fb8d2c446feeed9e01", }, }, } diff --git a/website/content/articles/.keep b/website/content/articles/.keep deleted file mode 100644 index e69de29b..00000000 diff --git a/website/content/getting-started.md b/website/content/getting-started.smd similarity index 100% rename from website/content/getting-started.md rename to website/content/getting-started.smd diff --git a/website/content/index.md b/website/content/index.smd similarity index 100% rename from website/content/index.md rename to website/content/index.smd diff --git a/website/layouts/index.shtml b/website/layouts/index.shtml index 9a784a2f..8c56d778 100644 --- a/website/layouts/index.shtml +++ b/website/layouts/index.shtml @@ -1,96 +1,76 @@ - -
- - -
-
-

- - goals

- -
    -
  • provide documents on how to get started with embedded programming (for absolute newbies)
  • -
  • provide example snippets for common operations on certain architectures (LPC, STM32, AVR, ...)
  • -
  • provide example worked through embedded mini-projects
  • -
  • create register definition libraries
  • -
  • create a common interface/HAL over several architectures
  • -
  • create a performant common set of drivers for external platforms
  • -
-
- -
-

- - important links

- - -
- -
-

- - community

- - +
+
+

+ + core members

+
- -
- vectorized Ember, the awesome zeg mascot! -
+
+