Notepad++ User Manual 4.6 Release #7
Workflow file for this run
This file contains 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
name: Zip Manual as Asset on Release | |
on: | |
# push: | |
# tags: | |
# - '*' | |
release: | |
types: [published] | |
jobs: | |
build: | |
runs-on: windows-latest | |
steps: | |
- name: 🚚 Checkout repo | |
uses: actions/checkout@v4 | |
- name: 📡 Install hugo-extended via chocolatey | |
working-directory: . | |
run: | | |
choco install hugo-extended --version 0.68.3 | |
- name: 🔨 Build static HTML for site | |
working-directory: . | |
run: | | |
hugo.exe -d static_html --theme hugo-book-9 --baseURL "http://localhost:1313" | |
# first do the changes that go in all the HTML files | |
Get-ChildItem -Recurse "./static_html" -Filter index.html | Foreach-Object { | |
$orgname = $_.FullName | |
$tmpname = "$($orgname).unedited" | |
Copy-Item $orgname $tmpname | |
get-content $tmpname | | |
%{$_ -replace 'id="book-search-input"','id="book-search-input" readonly hidden'} | | |
%{$_ -replace 'integrity="','attr_integ_ignore="'} | | |
set-content $orgname | |
Remove-Item $tmpname | |
} | |
# need different replacements at different depths | |
# top level: | |
Copy-Item "./static_html/index.html" "./static_html/index.html.source" | |
get-content "./static_html/index.html.source" | | |
%{$_ -replace '(href|content|src)="/','$1="./'} | | |
%{$_ -replace '(href|content|src)="http://localhost:1313/','$1="./'} | | |
%{$_ -replace '((?:href|content|src)="\./[^"]*?)/(#.*)?"','$1/index.html$2"'} | | |
set-content "./static_html/index.html" | |
Remove-Item "./static_html/index.html.source" | |
# need to delay the docs-level index, but save the existing copy, so that I can easily recurse | |
# to the deep directories, and then do the docs-level | |
Copy-Item "./static_html/docs/index.html" "./static_html/docs/index.html.source" | |
# recurse to the udl level | |
Get-ChildItem -Recurse "./static_html/docs/udl/" -Filter index.html | Foreach-Object { | |
$orgname = $_.FullName | |
$tmpname = "$($orgname).unedited" | |
Copy-Item $orgname $tmpname | |
get-content $tmpname | | |
%{$_ -replace '(href|content|src)="/','$1="../../../'} | | |
%{$_ -replace '(href|content|src)="http://localhost:1313/','$1="../../../'} | | |
%{$_ -replace '((?:href|content|src)="\.[^"]*?)/(#.*)?"','$1/index.html$2"'} | | |
set-content $orgname | |
Remove-Item $tmpname | |
} | |
# recurse to the docs/<pagename>/ level | |
Get-ChildItem -Recurse "./static_html/docs" -Filter index.html | Foreach-Object { | |
$orgname = $_.FullName | |
$tmpname = "$($orgname).unedited" | |
Copy-Item $orgname $tmpname | |
get-content $tmpname | | |
%{$_ -replace '(href|content|src)="/','$1="../../'} | | |
%{$_ -replace '(href|content|src)="http://localhost:1313/','$1="../../'} | | |
%{$_ -replace '((?:href|content|src)="\.[^"]*?)/(#.*)?"','$1/index.html$2"'} | | |
set-content $orgname | |
Remove-Item $tmpname | |
} | |
# now do the docs-level | |
get-content "./static_html/docs/index.html.source" | | |
%{$_ -replace '(href|content|src)="/','$1="../'} | | |
%{$_ -replace '(href|content|src)="http://localhost:1313/','$1="../'} | | |
%{$_ -replace '((?:href|content|src)="\.[^"]*?)/(#.*)?"','$1/index.html$2"'} | | |
set-content "./static_html/docs/index.html" | |
Remove-Item "./static_html/docs/index.html.source" | |
# now zip it | |
Rename-Item -Path static_html -NewName nppUserManual | |
Compress-Archive -Path nppUserManual -DestinationPath nppUserManual.zip | |
- name: 🎉 Store zipfile as asset | |
uses: svenstaro/upload-release-action@v2 | |
with: | |
repo_token: ${{ secrets.GITHUB_TOKEN }} | |
file: ./nppUserManual.zip | |
asset_name: nppUserManual.zip | |
tag: ${{ github.ref }} | |
overwrite: true | |
body: ${{ github.event.release.body }} | |
# `body: | ...` derived from the following sources, in order to duplicate the original commit message in the artifact upload | |
# - https://github.com/svenstaro/upload-release-action | |
# - https://stackoverflow.com/questions/63619329/github-action-get-commit-message |