generated from jimmychu0807/substrate-front-end-template
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #27 from islami00/development
(feat) added cd for demo project.
- Loading branch information
Showing
6 changed files
with
92 additions
and
69 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
const path = require('path'); | ||
const { exec } = require('child_process'); | ||
const { promisify } = require('util'); | ||
|
||
// Cd | ||
const prCWD = path.resolve(__dirname, '../'); | ||
process.chdir(prCWD); | ||
const execPromise = promisify(exec); | ||
// Get env, and tag | ||
const env = process.env.DEPLOY_ENV ? `-${process.env.DEPLOY_ENV}` : ''; | ||
const ref = process.env.GITHUB_REF; | ||
console.log('Producing tar artifact for ', ref); | ||
let ver = ''; | ||
let verEnv = ''; | ||
if (ref) { | ||
const refArr = ref.split('/'); | ||
verEnv = `${refArr[refArr.length - 1]}`; | ||
// Ret format: viii-?(nightly)-mm-dd-yy[1234] | ||
ver = `-${verEnv}`; | ||
} | ||
|
||
// Then do tar. | ||
(async function main() { | ||
// tar | ||
const { stderr, stdout } = await execPromise(`tar -cvf web-app-build${ver}.tar ./build`); | ||
console.log(stdout); | ||
if (stderr) { | ||
throw new Error(stderr); | ||
} | ||
const { stderr: var2Err, stdout: var2Out } = await execPromise( | ||
` | ||
echo "ARTIFACT_NAME=web-app-build${env}" >> $GITHUB_ENV && | ||
echo "ARTIFACT_PATH=web-app-build${ver}.tar" >> $GITHUB_ENV | ||
` | ||
); | ||
console.log(var2Out); | ||
if (var2Err) { | ||
throw new Error(var2Err); | ||
} | ||
})().catch((err) => { | ||
process.emitWarning(err); | ||
process.exitCode = 1; | ||
}); |