Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
10f6c24
creating initial docs site for auto generated docs
polatengin Jan 30, 2023
0f27077
adding node_modules folder to ignored files/folders list
polatengin Jan 30, 2023
afd6ca2
updating docs pipeline to publish auto generated docs to github pages
polatengin Jan 30, 2023
9f0814f
Merge branch 'main' into 130-deploy-auto-generated-docs-to-github-pages
polatengin Feb 6, 2023
f8f2a15
splitting ci pipeline into ci and cd pipelines
polatengin Feb 7, 2023
67dea0c
fixing yaml linter issue
polatengin Feb 7, 2023
790be47
fixing yaml linter issue
polatengin Feb 7, 2023
c428003
fixing linter warnings
polatengin Feb 7, 2023
24ad3b5
fixing linter warnings
polatengin Feb 7, 2023
108e884
fixing linter warnings
polatengin Feb 7, 2023
e61a5b7
fixing linter warnings
polatengin Feb 7, 2023
8f77fa2
fixing yaml linter issues
polatengin Feb 13, 2023
c6ef60d
fixing markdown linter issues
polatengin Feb 13, 2023
0cf070b
publishing event at the end of the ci pipeline
polatengin Feb 16, 2023
208112b
adding event trigger for the ci pipeline
polatengin Feb 16, 2023
f4b8f0d
creating initial documentation for docs site
polatengin Feb 16, 2023
9344ec2
fixing linter issues
polatengin Feb 16, 2023
ec08e72
fixing script path
polatengin Feb 16, 2023
9a5e560
renaming helper function
polatengin Feb 22, 2023
7507746
Merge branch 'main' into 130-deploy-auto-generated-docs-to-github-pages
polatengin Feb 22, 2023
a24a053
changing trigger event
polatengin Feb 27, 2023
0472e03
fixing filtered folders paths
polatengin Feb 27, 2023
6469938
bumping dependencies to latest version
polatengin Sep 22, 2023
554029a
merge branch main into 130-deploy-auto-generated-docs-to-github-pages
polatengin Sep 22, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions .github/scripts/generate-docs-workflow.psm1
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
function Format-AutoGeneratedMarkdownFile {
[CmdletBinding()]
param ([string]$Version)

foreach ($File in Get-ChildItem ./docs/helpers/*.md) {
# Add front matter
$Frontmatter = ""
$FrontMatter += "---`r`n"
$FrontMatter += "WARNING: `"PLEASE DO NOT MODIFY THIS FILE, IT'LL BE OVERWRITTEN`"`r`n"
$FrontMatter += "layout: `"../../layouts/main.astro`"`r`n"
$FrontMatter += "title: `"$($File.BaseName)`"`r`n"
$FrontMatter += "module: `"BenchPress.Azure`"`r`n"
$FrontMatter += "version: `"$Version`"`r`n"
$FrontMatter += "updatedOn: `"$(Get-Date -Format "yyyy-MM-dd HH:mm K")`"`r`n"
$FrontMatter += "---`r`n"
# Fix escaping issues
$Content = Get-Content $File -Raw
$Content = $Content -Replace '\\`', '`'
$Content = $Content -Replace "\\\[", "["
$Content = $Content -Replace "\\\]", "]"
# Fix syntax highlighting
$Lines = $Content -Split "`r`n"
for ($i = 0; $i -lt $Lines.Length; $i++) {
if ($Lines[$i] -match "^## SYNTAX") {
$j = $i + 2
if ($Lines[$j] -match '```') {
$Lines[$j] = $Lines[$j] -Replace '```', '```powershell'
}
}
}
# Write out the file back
Set-Content $File ($FrontMatter + ($Lines -join "`r`n"))
}
}
85 changes: 85 additions & 0 deletions .github/workflows/cd-publish-docs-branch.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
---
# yamllint disable line-length
name: "Publish docs to GitHub Pages"

on: # yamllint disable-line rule:truthy
push:
branches:
- docs
paths:
- docs/**
- docs-site/**
workflow_dispatch:

permissions:
contents: read
pages: write
id-token: write

env:
BUILD_PATH: "./docs-site"

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
ref: docs
token: ${{ secrets.DOCS_ACTION_TOKEN }}

- name: Copy from docs/helpers to docs-site/src/pages/docs
shell: pwsh
run: |
New-Item -ItemType Directory -Path "./docs-site/src/pages/docs" -Force
Copy-Item -Path "./docs/helpers/*" -Destination "./docs-site/src/pages/docs" -Include "*.md" -Recurse -Force

- name: Detect package manager
id: detect-package-manager
run: |
{
echo 'manager=npm'
echo 'command=ci'
echo 'runner=npx --no-install'
} >> "$GITHUB_OUTPUT"

- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: "16"
cache: ${{ steps.detect-package-manager.outputs.manager }}
cache-dependency-path: ${{ env.BUILD_PATH }}/package-lock.json

- name: Setup Pages
id: pages
uses: actions/configure-pages@v2

- name: Install dependencies
run: ${{ steps.detect-package-manager.outputs.manager }} ${{ steps.detect-package-manager.outputs.command }}
working-directory: ${{ env.BUILD_PATH }}

- name: Build with Astro
run: |
${{ steps.detect-package-manager.outputs.runner }} astro build \
--site "${{ steps.pages.outputs.origin }}" \
--base "${{ steps.pages.outputs.base_path }}"
working-directory: ${{ env.BUILD_PATH }}

- name: Upload artifact
uses: actions/upload-pages-artifact@v1
with:
path: ${{ env.BUILD_PATH }}/dist

deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
needs: build
runs-on: ubuntu-latest
name: Deploy
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v1
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -111,3 +111,5 @@ StyleCopReport.xml
!?*.[Cc]ache/

megalinter-reports/

node_modules
15 changes: 15 additions & 0 deletions docs-site/astro.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { defineConfig } from "astro/config";

import tailwind from "@astrojs/tailwind";

export default defineConfig({
base: "/benchpress",
markdown: {
shikiConfig: {
theme: "dark-plus"
}
},
integrations: [tailwind({
config: { applyBaseStyles: false },
})]
});
Loading