Skip to content

Commit

Permalink
chore: include "v" prefix in versions.json
Browse files Browse the repository at this point in the history
  • Loading branch information
aleclarson committed Aug 17, 2024
1 parent 16db90d commit d49f1a7
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions scripts/docs/ci-publish-docs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ async function main() {
}

/** This is the identifier used by URLs. */
let newReleaseId = String(newReleaseMajor)
let newReleaseId = 'v' + String(newReleaseMajor)
if (newReleaseParts.length > 3) {
if (newReleaseMajor === lastReleaseMajor) {
newReleaseId += '.' + newReleaseMinor
Expand All @@ -138,7 +138,7 @@ async function main() {
newReleaseId += '-' + newReleaseParts[3]
}

log('Publishing docs for version:', 'v' + newReleaseId)
log('Publishing docs for version:', newReleaseId)

log('Cloning main branch of radashi-org.github.io')
await execa(
Expand Down Expand Up @@ -246,9 +246,11 @@ async function main() {
JSON.stringify([...versions]),
)

log('Removing docs for unmaintained versions')
for (const removedVersion of removedVersions) {
await fs.rm(`./www/dist/${removedVersion}`, { recursive: true })
if (removedVersions.size > 0) {
log('Removing docs for unmaintained versions')
for (const removedVersion of removedVersions) {
await fs.rm(`./www/dist/${removedVersion}`, { recursive: true })
}
}

log('Removing docs that will be overwritten')
Expand All @@ -275,7 +277,7 @@ async function main() {

log('Pushing to gh-pages branch')
await execa('git', ['add', '-A'], { cwd: './www/dist' })
await execa('git', ['commit', '-m', `chore: v${newReleaseId}`], {
await execa('git', ['commit', '-m', `chore: ${newReleaseId}`], {
cwd: './www/dist',
stdio: 'inherit',
})
Expand Down Expand Up @@ -305,7 +307,7 @@ function exit() {
* ```
*/
function toRawVersion(version: string) {
let [, rawVersion] = version.match(/^(\d+(?:\.\d+(?:\.\d+)?)?)/)!
let [, rawVersion] = version.match(/^v?(\d+(?:\.\d+(?:\.\d+)?)?)/)!
for (let i = rawVersion.split('.').length; i < 3; i++) {
rawVersion += '.0'
}
Expand Down

0 comments on commit d49f1a7

Please sign in to comment.