diff --git a/README.md b/README.md index bd0f88d..a3a25a8 100644 --- a/README.md +++ b/README.md @@ -11,11 +11,74 @@ * Branch: auto-images - * Directory: `/docs/images` + * Directory: `/docs/images/badges` ## Usage -Use this with CI tools +### Development Environment + +#### Building & Testing + +##### Setup environment + +```bash +npm install && npm install --only=dev +``` + +##### Building + +```bash +npm run build +``` + +##### Testing + +```bash +npm test +``` + +#### Preview + +The following scripts create `/.preview.html` which shows every created artifacts + - `npm run preview` + - `npm run build` + - `npm run test` (or `npm test`) + +If `/sh/previewer.sh` is a file, the file will run as a bash script with `$1` is path to `/.preview.html` + +### Deployment Environment + +#### Branch vs Tag + +If you push changes to a branch, CI tools will test only (by `npm test`) + +If you push tags, CI tools will do both test and deploy + +There're 3 types of releases depend on tag suffix + - `-alpha`: Draft Release + - `-beta`: Prerelease + - no suffix: Official & Stable Release + +Deployment is vary, depends on which environment variable is turned on + +#### GitHub Release + +This type of deployment requires `GITHUB_RELEASE_OAUTH` + +#### Gist Repository + +This type of deployment requires 3 environment variables + - `RELEASE_GIST` is set to `TRUE` + - `GIST_ID` + - `GIST_TOKEN` + +#### GitHub Repository Commit + +This type of deployment requires 4 environment variables + - `TARGET_GITHUB_RELEASE_OAUTH` (optional, default to `GITHUB_RELEASE_OAUTH`) + - `TARGET_GITHUB_REPO_OWNER` + - `TARGET_GITHUB_REPO_NAME` + - `TARGET_GITHUB_REPO_BRANCH` ## License diff --git a/deploy/github-target-repo/index.js b/deploy/github-target-repo/index.js index 94efe68..2fd8b20 100644 --- a/deploy/github-target-repo/index.js +++ b/deploy/github-target-repo/index.js @@ -74,7 +74,7 @@ function * main () { const parents = [baseCommitSHA] const {sha: baseTreeSHA, tree: baseTree} = yield github.gitdata.getTree({user, repo, sha: baseCommitSHA}) info('Base Tree SHA', baseTreeSHA) - info({baseTree, baseTreeSHA, baseCommitSHA, baseRefSHA}) + info({baseTreeSHA, baseCommitSHA, baseRefSHA}) info(`Reading ${ARTIFACTS_DIRECTORY}`) const list = readdirSync(ARTIFACTS_DIRECTORY) .map( @@ -120,7 +120,6 @@ function * main () { ({path}) => listpath.every(([diff]) => path !== diff) ) const resultTree = [...restTree, ...diffTree] - info({listpath, diffTree, restTree, baseTree, resultTree}) const {sha: tree} = yield github.gitdata.createTree({tree: resultTree, base_tree: baseTreeSHA, user, repo}) info('New Tree SHA', tree) const message = (