Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
3 changes: 0 additions & 3 deletions .github/workflows/build-push.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
name: build preview

on:
release:
types:
- published
pull_request:
branches:
- "*"
Expand Down
24 changes: 24 additions & 0 deletions .github/workflows/release-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Build preview on documentation repo upon release publish

on:
release:
types:
- published

env:
OWNER: nginx
REPO: documentation

jobs:
trigger-documentation-build:
runs-on: ubuntu-latest
steps:
- name: Trigger 'Build and deploy' workflow in 'documentation' repo
run: |
curl -L \
-X POST \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer ${{ secrets.DOCUMENTATION_SLACK_FLOW_PAT }}" \
-H "X-GitHub-Api-Version: 2022-11-28" \
"https://api.github.com/repos/${{ env.OWNER }}/${{ env.REPO }}/dispatches" \
-d "{\"event_type\": \"trigger-preview-build\", \"client_payload\": {\"environment\": \"preview\", \"hugo_theme_override\": \"\", \"author\": \"${{ github.event.release.author.login }}\", \"tag_name\": \"${{ github.event.release.tag_name }}\", \"release_name\": \"${{ github.event.release.name }}\"}}"
49 changes: 49 additions & 0 deletions .github/workflows/slack-notification.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Slack notification for new theme release

on:
repository_dispatch:
types: [trigger-slack-notification]

permissions:
contents: read

jobs:
release-notification:
runs-on: ubuntu-latest
permissions:
contents: read
actions: read # for 8398a7/action-slack
checks: read
steps:
- name: Send notification
uses: 8398a7/action-slack@1750b5085f3ec60384090fb7c52965ef822e869e # v3.18.0
with:
status: custom
custom_payload: |
{
username: 'Github',
mention: 'channel',
attachments: [{
title: `New theme release - ${{ github.event.client_payload.release_name }}`,
color: '#009223',
fields: [
{
title: 'Tag',
value: ${{ github.event.client_payload.tag_name }},
short: true
},
{
title: 'Author',
value: ${{ github.event.client_payload.author }},
short: true
},
{
title: 'Preview URL',
value: ${{ github.event.client_payload.previewURL }},
short: true
}]
}]
}
env:
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
55 changes: 2 additions & 53 deletions layouts/_default/docs.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,59 +5,8 @@
{{ partial "sidebar.html" . }}
</nav>

{{$content := .Content}}
{{$pattern := `<i[^>]*class=["'][^"']*(?:fas?|fa-solid|fa-regular|fa-brands|far)\s+fa-([^"'\s]+)[^"']*["'][^>]*?(?:\s+style=["']([^"']*)["'])?[^>]*></i>`}}
{{$matches := findRE $pattern $content}}

{{range $matches}}
{{$currentMatch := .}}
{{$iconName := ""}}
{{$styleAttr := ""}}

{{$submatches := findRESubmatch $pattern $currentMatch}}
{{if gt (len $submatches) 0}}
{{$iconName = index (index $submatches 0) 1}}
{{$styleAttr = index (index $submatches 0) 2}}

{{- $iconMappings := dict
"bug-slash" "bug-off"
"circle-info" "info"
"info-circle" "info"
"file-circle-plus" "file-plus"
"check-circle" "circle-check"
"heartbeat" "heart-pulse"
"code-branch" "git-branch"
"desktop" "monitor"
"certificate" "badge"
"cogs" "cog"
"shield-alt" "shield-half"
"memory" "cpu"
"hdd" "hard-drive"
"exclamation-triangle" "triangle-alert"
"triangle-exclamation" "triangle-alert"
"tachometer-alt" "circle-gauge"
"circle-exclamation" "circle-alert"
"arrow-up-right-from-square" "external-link"
"pen-to-square" "square-pen"
"flask" "flask-conical"
-}}

{{ with index $iconMappings $iconName }}
{{$iconName = .}}
{{ end }}

{{$iconHTML := partial "lucide" (dict
"context" $
"icon" $iconName
"style" $styleAttr
)}}

{{ $modifiedMatch := replaceRE `>` ` data-mf=false>` $currentMatch 1}}
{{ $modifiedMFIcon := printf "%s %s" $modifiedMatch $iconHTML }}
{{$content = replace $content $currentMatch $modifiedMFIcon}}

{{end}}
{{end}}
<!-- Replace icons -->
{{ $content := partial "icon-replacement.html" (dict "content" .Content) }}

{{if (.Params.catalog) }}
<main class="content content-has-toc" role="main">
Expand Down
54 changes: 54 additions & 0 deletions layouts/partials/icon-replacement.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
{{ $content := .content }}
{{ $pattern := `<i[^>]*class=["'][^"']*(?:fas?|fa-solid|fa-regular|fa-brands|far)\s+fa-([^"'\s]+)[^"']*["'][^>]*?(?:\s+style=["']([^"']*)["'])?[^>]*></i>` }}
{{ $matches := findRE $pattern $content }}

{{range $matches}}
{{$currentMatch := .}}
{{$iconName := ""}}
{{$styleAttr := ""}}

{{$submatches := findRESubmatch $pattern $currentMatch}}
{{if gt (len $submatches) 0}}
{{$iconName = index (index $submatches 0) 1}}
{{$styleAttr = index (index $submatches 0) 2}}

{{- $iconMappings := dict
"bug-slash" "bug-off"
"circle-info" "info"
"info-circle" "info"
"file-circle-plus" "file-plus"
"check-circle" "circle-check"
"heartbeat" "heart-pulse"
"code-branch" "git-branch"
"desktop" "monitor"
"certificate" "badge"
"cogs" "cog"
"shield-alt" "shield-half"
"memory" "cpu"
"hdd" "hard-drive"
"exclamation-triangle" "triangle-alert"
"triangle-exclamation" "triangle-alert"
"tachometer-alt" "circle-gauge"
"circle-exclamation" "circle-alert"
"arrow-up-right-from-square" "external-link"
"pen-to-square" "square-pen"
"flask" "flask-conical"
-}}

{{ with index $iconMappings $iconName }}
{{$iconName = .}}
{{ end }}

{{$iconHTML := partial "lucide" (dict
"context" $
"icon" $iconName
"style" $styleAttr
)}}

{{ $modifiedMatch := replaceRE `>` ` data-mf=false>` $currentMatch 1 }}
{{ $modifiedMFIcon := printf "%s %s" $modifiedMatch $iconHTML }}
{{ $content = replace $content $currentMatch $modifiedMFIcon }}
{{end}}
{{end}}

{{ return $content }}
Loading