-
Notifications
You must be signed in to change notification settings - Fork 15
deploy auto generated docs to GitHub pages #131
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
polatengin
wants to merge
24
commits into
main
Choose a base branch
from
130-deploy-auto-generated-docs-to-github-pages
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
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 0f27077
adding node_modules folder to ignored files/folders list
polatengin afd6ca2
updating docs pipeline to publish auto generated docs to github pages
polatengin 9f0814f
Merge branch 'main' into 130-deploy-auto-generated-docs-to-github-pages
polatengin f8f2a15
splitting ci pipeline into ci and cd pipelines
polatengin 67dea0c
fixing yaml linter issue
polatengin 790be47
fixing yaml linter issue
polatengin c428003
fixing linter warnings
polatengin 24ad3b5
fixing linter warnings
polatengin 108e884
fixing linter warnings
polatengin e61a5b7
fixing linter warnings
polatengin 8f77fa2
fixing yaml linter issues
polatengin c6ef60d
fixing markdown linter issues
polatengin 0cf070b
publishing event at the end of the ci pipeline
polatengin 208112b
adding event trigger for the ci pipeline
polatengin f4b8f0d
creating initial documentation for docs site
polatengin 9344ec2
fixing linter issues
polatengin ec08e72
fixing script path
polatengin 9a5e560
renaming helper function
polatengin 7507746
Merge branch 'main' into 130-deploy-auto-generated-docs-to-github-pages
polatengin a24a053
changing trigger event
polatengin 0472e03
fixing filtered folders paths
polatengin 6469938
bumping dependencies to latest version
polatengin 554029a
merge branch main into 130-deploy-auto-generated-docs-to-github-pages
polatengin File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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")) | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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: | ||
polatengin marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| 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 | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -111,3 +111,5 @@ StyleCopReport.xml | |
| !?*.[Cc]ache/ | ||
|
|
||
| megalinter-reports/ | ||
|
|
||
| node_modules | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 }, | ||
| })] | ||
| }); |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.