Commit c59de58
Fix Docusaurus versioning error in publish_website workflow (#3218)
Summary:
Fix Docusaurus version deletion not matching 'v' prefixed directories
## Problem
The 'Delete existing similar versions from Docusaurus' step fails to find and delete existing versions when the release workflow is re-run. This causes the subsequent 'Create new docusaurus version' step to fail with:
```
Error: [docs]: this version already exists! Use a version tag that does not already exist.
```
## Root Cause
When Docusaurus creates a version with `yarn docusaurus docs:version v0.17.2`, it creates directories/files with the 'v' prefix:
- `versioned_docs/version-v0.17.2/`
- `versioned_sidebars/version-v0.17.2-sidebars.json`
But the delete step was stripping the 'v' prefix before searching:
```bash
MAJOR_MINOR_VERSION=$(cut -d '.' -f 1-2 <<< v0.17.2) # gives 'v0.17'
MAJOR_MINOR_VERSION=${MAJOR_MINOR_VERSION#v} # strips to '0.17'
for dir in website/versioned_docs/version-$MAJOR_MINOR_VERSION.* # looks for 'version-0.17.*'
```
The glob `version-0.17.*` never matches `version-v0.17.2/`, so nothing gets deleted.
## Solution
Search for both patterns (with and without 'v' prefix):
```bash
for pattern in "version-$MAJOR_MINOR_VERSION.*" "version-${MAJOR_MINOR_VERSION#v}.*"; do
```
Also added `-f` flag to `rm` for sidebars to avoid errors if file doesn't exist.
Reviewed By: saitcakmak
Differential Revision: D953054761 parent ee72a65 commit c59de58
1 file changed
Lines changed: 16 additions & 14 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
65 | 65 | | |
66 | 66 | | |
67 | 67 | | |
68 | | - | |
69 | | - | |
70 | | - | |
71 | | - | |
72 | | - | |
73 | | - | |
74 | | - | |
75 | | - | |
76 | | - | |
77 | | - | |
78 | | - | |
79 | | - | |
80 | | - | |
81 | | - | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
82 | 84 | | |
83 | 85 | | |
84 | 86 | | |
| |||
0 commit comments