-
Notifications
You must be signed in to change notification settings - Fork 89
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: enhanced scripting workflow (#726)
- Loading branch information
Showing
12 changed files
with
1,085 additions
and
257 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,7 @@ node_modules | |
.changelog | ||
.vscode | ||
.netlify | ||
.env | ||
|
||
# Package specific | ||
packages/**/dist | ||
|
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,45 @@ | ||
#!/usr/bin/env node | ||
|
||
/** | ||
* Copyright Zendesk, Inc. | ||
* | ||
* Use of this source code is governed under the Apache License, Version 2.0 | ||
* found at http://www.apache.org/licenses/LICENSE-2.0. | ||
*/ | ||
|
||
const envalid = require('envalid'); | ||
const garden = require('@zendeskgarden/scripts'); | ||
const path = require('path'); | ||
|
||
envalid.cleanEnv(process.env, { | ||
GITHUB_TOKEN: envalid.str(), | ||
NETLIFY_SITE_ID: envalid.str(), | ||
NETLIFY_TOKEN: envalid.str() | ||
}); | ||
|
||
(async () => { | ||
const branch = await garden.githubBranch(); | ||
const dir = path.resolve(__dirname, '..', '..', 'demo'); | ||
let url; | ||
|
||
if (branch === 'master') { | ||
url = await garden.githubPages({ dir }); | ||
} else { | ||
const repository = await garden.githubRepository(); | ||
const commit = await garden.githubCommit(); | ||
const message = `https://github.com/${repository.owner}/${repository.repo}/commit/${commit}`; | ||
const command = async () => { | ||
const result = await garden.netlifyDeploy({ | ||
dir, | ||
message | ||
}); | ||
|
||
return result; | ||
}; | ||
|
||
url = await garden.githubDeploy({ command }); | ||
} | ||
|
||
/* eslint-disable-next-line no-console */ | ||
console.log(`Deployed to ${url}`); | ||
})(); |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
File renamed without changes.
Oops, something went wrong.