Browse Source

Git workflow added and generate_commands_markdown.sh made to be more platform agnostic

James 1 month ago
parent
commit
2e82af6068
3 changed files with 77 additions and 7 deletions
  1. 42 0
      .github/workflows/generate-docs.yaml
  2. 29 0
      config/config.yaml
  3. 6 7
      generate_commands_markdown.sh

+ 42 - 0
.github/workflows/generate-docs.yaml

@@ -0,0 +1,42 @@
+name: Generate CLI Docs
+
+on:
+  push:
+    branches: [ main ]
+  workflow_dispatch:
+
+jobs:
+  build-docs:
+    runs-on: ubuntu-latest
+
+    steps:
+      - name: Checkout repository
+        uses: actions/checkout@v4
+
+      - name: Setup .NET
+        uses: actions/setup-dotnet@v4
+        with:
+          dotnet-version: '10.0.x'
+
+      - name: Ensure publish directory exists
+        run: mkdir -p RackPeek/publish
+
+      - name: Copy config folder into publish directory
+        run: |
+          if [ -d RackPeek/config ]; then
+            cp -r RackPeek/config RackPeek/publish/config
+          fi
+
+      - name: Make script executable
+        run: chmod +x generate-docs.sh
+
+      - name: Run documentation generator
+        run: ./generate-docs.sh
+
+      - name: Commit and push generated docs
+        run: |
+          git config user.name "github-actions"
+          git config user.email "github-actions@github.com"
+          git add CommandIndex.md Commands.md
+          git commit -m "Update CLI docs" || echo "No changes to commit"
+          git push

+ 29 - 0
config/config.yaml

@@ -0,0 +1,29 @@
+resources:
+- kind: System
+  type: 
+  os: 
+  cores: 
+  ram: 
+  drives: 
+  runsOn: 
+  name: xf
+  tags: 
+- kind: Service
+  network:
+    ip: dfdf
+    port: 6
+    protocol: 10.2.0.1
+    url: 
+  runsOn: xf
+  name: dfs
+  tags: 
+- kind: Switch
+  model: 
+  managed: 
+  poe: 
+  ports:
+  - type: rj45
+    speed: 1
+    count: 24
+  name: core-sw1
+  tags: 

+ 6 - 7
generate_commands_markdown.sh

@@ -15,19 +15,18 @@ trap 'rm -f "$TREE_TEMP" "$BODY_TEMP"' EXIT
 # ----------------------------
 # ----------------------------
 
 
 strip_colors() {
 strip_colors() {
-  sed -r "s/\x1B\[[0-9;]*[mK]//g"
+  sed -E "s/\x1B\[[0-9;]*[mK]//g"
 }
 }
 
 
 run_help() {
 run_help() {
-  local project="./RackPeek"
-  local runtime="osx-arm64"
-  local config="Release"
-  local publish_dir="$project/bin/$config/net10.0/$runtime/publish"
-  local exe="$publish_dir/RackPeek"
+ local project="./RackPeek" 
+ local config="Release" 
+ local publish_dir="$project/publish" 
+ local exe="$publish_dir/RackPeek"
 
 
   if [[ ! -x "$exe" ]]; then
   if [[ ! -x "$exe" ]]; then
     echo "Publishing RackPeek ($config)..." >&2
     echo "Publishing RackPeek ($config)..." >&2
-    dotnet publish "$project" -c "$config" -r "$runtime" --self-contained false -p:PublishSingleFile=true >&2
+    dotnet publish "$project" -c "$config" -o "$publish_dir" --self-contained false -p:PublishSingleFile=true >&2
   fi
   fi
 
 
   local output
   local output