Skip to content

Commit

Permalink
Add new release manual for website
Browse files Browse the repository at this point in the history
  • Loading branch information
zoobestik committed Jun 27, 2022
1 parent 4dff42d commit 7ccd187
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 65 deletions.
3 changes: 2 additions & 1 deletion RELEASE.md
Expand Up @@ -63,7 +63,8 @@ To release a new `<version>` of `kotlinx-coroutines`:
* Cut & paste lines from [`CHANGES.md`](CHANGES.md) into description.

4. Build and publish the documentation for the web-site: <br>
`site/deploy.sh <version> push`
* Set new value for [`kotlinx.coroutines.release.tag`](https://buildserver.labs.intellij.net/admin/editProject.html?projectId=Kotlin_KotlinSites_Builds_KotlinlangOrg_LibrariesAPIs&tab=projectParams)
* And run deploy [configuration](https://buildserver.labs.intellij.net/buildConfiguration/Kotlin_KotlinSites_Builds_KotlinlangOrg_KotlinCoroutinesApi?branch=%3Cdefault%3E&buildTypeTab=overview&mode=builds)

5. Announce the new release in [Slack](https://kotlinlang.slack.com)

Expand Down
42 changes: 42 additions & 0 deletions redirects.mjs
@@ -0,0 +1,42 @@
import { cwd } from 'process';
import { extname, resolve } from 'path';
import { promises as fsPromises } from 'fs';

const { readdir, writeFile, unlink } = fsPromises

async function* getFiles(dir) {
const dirents = await readdir(dir, { withFileTypes: true });

for (const dirent of dirents) {
const { name } = dirent;
const fullPath = resolve(dir, name);

if (dirent.isDirectory()) {
yield* getFiles(fullPath);
} else {
yield { name, fullPath };
}
}
}

(async function main() {
const cwdpath = cwd();
const library = 'kotlinx.coroutines';

for await (const { name, fullPath } of getFiles(cwdpath)) {
if (name === 'navigation.html') await unlink(fullPath);
else {
const ext = extname(name);

if (ext === '.html') {
let relativeUrl = fullPath.substring(cwdpath.length + 1);

if (name === 'index.html')
relativeUrl = relativeUrl.substring(0, relativeUrl.length - 'index.html'.length);

const url = new URL(`/api/${library}/${relativeUrl}`, 'https://kotlinlang.org');
await writeFile(fullPath, `<script>window.location = '${url}' + window.location.hash;</script><meta http-equiv="refresh" content="0; url=${url}"/>`);
}
}
}
})();
64 changes: 0 additions & 64 deletions site/deploy.sh

This file was deleted.

0 comments on commit 7ccd187

Please sign in to comment.