Skip to content

Commit

Permalink
fix: release
Browse files Browse the repository at this point in the history
  • Loading branch information
BelfordZ committed Apr 23, 2019
1 parent e5706a1 commit 4544160
Show file tree
Hide file tree
Showing 4 changed files with 360 additions and 349 deletions.
13 changes: 5 additions & 8 deletions bin/build.ghpages.sh
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
#!/usr/bin/env node

const {promisify} = require("util");
const downloadReleases = require('@etclabscore/dl-github-releases');
const downloadReleases = require('@etclabscore/dl-github-releases').default;
const fs = require("fs");
const mkdir = promisify(fs.mkdir);
const copyFile = promisify(fs.copyFile);
const writeFile = promisify(fs.writeFile);
const unlink = promisify(fs.unlink);
const readdir = promisify(fs.readdir);
const fsx = require("fs-extra");
const buildMarkdown = require("./build.markdown.sh");
Expand All @@ -31,12 +30,10 @@ const build = async () => {

const previousVersions = await readdir(buildDir);

await Promise.all(previousVersions.map(async (previousVersion) => {
const version = previousVersion.replace(".md", "");
const newDirName = `${buildDir}${version}`;
await mkdir(newDirName);
await copyFile(`${buildDir}${previousVersion}`, `${newDirName}/index.md`);
await unlink(`${buildDir}${previousVersion}`);
await Promise.all(previousVersions.map(async (version) => {
const dirName = `${buildDir}${version}`;
const [filename] = await readdir(dirName);
await fsx.move(`${dirName}/${filename}`, `${dirName}/index.md`);
}));

await buildMarkdown();
Expand Down
4 changes: 1 addition & 3 deletions bin/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@ const build = async () => {
.filter((filename) => filename.includes("build.") && filename !== "build.sh")
.map((filename) => filename.split(".")[1]);

buildTargets.forEach(async (buildTarget) => {
await require(`${__dirname}/build.${buildTarget}.sh`)();
});
await Promise.all(buildTargets.map((buildTarget) => require(`${__dirname}/build.${buildTarget}.sh`)()));

console.log("build complete");
};
Expand Down
Loading

0 comments on commit 4544160

Please sign in to comment.