-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Include CDM in external folder via manifest file
- Loading branch information
Showing
5 changed files
with
69 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
hpc_cdm |
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,9 @@ | ||
name: 'Setup External Repos' | ||
description: 'Clone repositories specified in manifest file' | ||
author: 'Sam Lanning <[email protected]>' | ||
runs: | ||
using: 'node16' | ||
main: 'setup.js' | ||
branding: | ||
icon: 'download-cloud' | ||
color: 'purple' |
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,7 @@ | ||
[ | ||
{ | ||
"path": "hpc_cdm", | ||
"url": "https://github.com/UN-OCHA/hpc-cdm.git", | ||
"ref": "develop" | ||
} | ||
] |
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,47 @@ | ||
// @ts-check | ||
|
||
const child_process = require('child_process'); | ||
const path = require('path'); | ||
const { promises: { stat }} = require('fs'); | ||
const { promisify } = require('util'); | ||
|
||
const manifest = require('./manifest.json'); | ||
|
||
const exec = promisify(child_process.exec); | ||
|
||
(async () => { | ||
|
||
for (const entry of manifest) { | ||
const p = path.resolve(__dirname, entry.path); | ||
console.log(`Setting up external repo ${p}`); | ||
|
||
const exists = await stat(p).then(() => true).catch(() => false); | ||
if (!exists) { | ||
// Clone repository | ||
const clone = await exec(`git clone "${entry.url}" "${p}"`); | ||
console.log(clone.stderr); | ||
console.log(clone.stdout); | ||
} | ||
|
||
// Fetch desired commit | ||
const fetch = await exec( | ||
`git fetch origin ${entry.ref}`, | ||
{ | ||
cwd: p | ||
} | ||
); | ||
console.log(fetch.stderr); | ||
console.log(fetch.stdout); | ||
|
||
// Fetch desired commit | ||
const checkout = await exec( | ||
`git checkout ${entry.ref}`, | ||
{ | ||
cwd: p | ||
} | ||
); | ||
console.log(checkout.stderr); | ||
console.log(checkout.stdout); | ||
} | ||
|
||
})(); |
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