Skip to content

Commit 36842e1

Browse files
author
Donna-Marie Smith
committed
Testing Create Latest
1 parent fea2d78 commit 36842e1

File tree

2 files changed

+33
-3
lines changed

2 files changed

+33
-3
lines changed
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
name: Run HTML Tests
2+
on:
3+
# Runs on pushes targeting the default branch
4+
push:
5+
branches: ["test-createLatest"]
6+
jobs:
7+
htmltest:
8+
runs-on: ubuntu-latest
9+
env:
10+
HUGO_VERSION: 0.110.0
11+
concurrency:
12+
group: ${{ github.workflow }}-${{ github.ref }}
13+
steps:
14+
- name: Update Latest Content
15+
run: |
16+
..\..\createLatest.ps1

createLatest.ps1

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,17 @@
1-
Remove-item -ItemType Directory -Path "content/en/docs/latest/" -Force
2-
New-Item -ItemType Directory -Path "content/en/docs/latest/" -Force
3-
Copy-Item -Path "content/en/docs/2024.11/*" -Destination "content/en/docs/latest/" -Recurse -Force
1+
$Path = ".\config\_default\config.toml"
2+
$latestName = "latest"
3+
4+
$LatestVersion = (Select-String -Path $Path -Pattern "latest = true" -Context 3, 0) -split "`""
5+
6+
#Use $LatestVersion[1] as we know that the version is the first line returned and splitting on " makes it the 2nd index
7+
$Version = $LatestVersion[1]
8+
9+
if (Test-Path ".\content\en\docs\$latestName"){
10+
Remove-Item -LiteralPath ".\content\en\docs\$latestName" -Force -Recurse
11+
}
12+
New-Item -ItemType Directory -Path ".\content\en\docs\$latestName\" -Force
13+
Copy-Item -Path ".\content\en\docs\$Version\*" -Destination ".\content\en\docs\$latestName\" -Recurse -Force
14+
(Get-Content .\content\en\docs\latest\_index.md) -replace $Version, "Latest" | Set-Content .\content\en\docs\latest\_index.md
15+
16+
New-Item -ItemType Directory -Path ".\content\static\$latestName\" -Force
17+
Copy-Item -Path ".\content\static\$Version\*" -Destination ".\content\static\$latestName\" -Recurse -Force

0 commit comments

Comments
 (0)