Skip to content

Commit

Permalink
Merge pull request #1 from defenseunicorns/no-prerelease
Browse files Browse the repository at this point in the history
fix: make 'most current' version NOT include prereleases
  • Loading branch information
btlghrants authored Jan 16, 2024
2 parents 6f61a1e + 1dca91c commit 52df77b
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions build/index.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -341,10 +341,13 @@ await activity(`Update version dropdown options`, async (log) => {
const hugoConf = yaml.parse(hugoYaml)

const uniques = {}
RUN.versions.filter(v => v !== 'main').forEach(version => {
const mm = majmin(version)
if (!uniques.hasOwnProperty(mm)) { uniques[mm] = version }
})
RUN.versions
.filter(v => v !== 'main')
.filter(v => semver.prerelease(v) === null)
.forEach(version => {
const mm = majmin(version)
if (!uniques.hasOwnProperty(mm)) { uniques[mm] = version }
})

const opts = Object.entries(uniques).map(([majmin, version]) => ({
version: `v${majmin}`,
Expand All @@ -370,7 +373,7 @@ await activity(`Clear '/current' version alias`, async () => {
})

await activity(`Set '/current' version alias`, async (log) => {
const current = RUN.versions[0]
const current = RUN.versions.filter(v => semver.prerelease(v) === null)[0]
const verPath = `${RUN.work}/content/en/${current}/_index.md`
let content = await fs.readFile(verPath, { encoding: 'utf8' })

Expand Down

0 comments on commit 52df77b

Please sign in to comment.