Skip to content

Commit dbe7868

Browse files
committed
Deploy Production Code for Commit 1bca7e0 🚀
1 parent 1bca7e0 commit dbe7868

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

77 files changed

+970
-345
lines changed

lib/constants.js

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -35,55 +35,55 @@ var TestFlag;
3535
})(TestFlag = exports.TestFlag || (exports.TestFlag = {}));
3636
/* Required action data that gets initialized when running within the GitHub Actions environment. */
3737
exports.action = {
38-
folder: core_1.getInput('folder'),
39-
branch: core_1.getInput('branch'),
40-
commitMessage: core_1.getInput('commit-message'),
41-
dryRun: !util_1.isNullOrUndefined(core_1.getInput('dry-run'))
42-
? core_1.getInput('dry-run').toLowerCase() === 'true'
38+
folder: (0, core_1.getInput)('folder'),
39+
branch: (0, core_1.getInput)('branch'),
40+
commitMessage: (0, core_1.getInput)('commit-message'),
41+
dryRun: !(0, util_1.isNullOrUndefined)((0, core_1.getInput)('dry-run'))
42+
? (0, core_1.getInput)('dry-run').toLowerCase() === 'true'
4343
: false,
44-
clean: !util_1.isNullOrUndefined(core_1.getInput('clean'))
45-
? core_1.getInput('clean').toLowerCase() === 'true'
44+
clean: !(0, util_1.isNullOrUndefined)((0, core_1.getInput)('clean'))
45+
? (0, core_1.getInput)('clean').toLowerCase() === 'true'
4646
: false,
47-
cleanExclude: (core_1.getInput('clean-exclude') || '')
47+
cleanExclude: ((0, core_1.getInput)('clean-exclude') || '')
4848
.split('\n')
4949
.filter(l => l !== ''),
5050
hostname: process.env.GITHUB_SERVER_URL
51-
? util_1.stripProtocolFromUrl(process.env.GITHUB_SERVER_URL)
51+
? (0, util_1.stripProtocolFromUrl)(process.env.GITHUB_SERVER_URL)
5252
: 'github.com',
5353
isTest: TestFlag.NONE,
54-
email: !util_1.isNullOrUndefined(core_1.getInput('git-config-email'))
55-
? core_1.getInput('git-config-email')
54+
email: !(0, util_1.isNullOrUndefined)((0, core_1.getInput)('git-config-email'), true)
55+
? (0, core_1.getInput)('git-config-email')
5656
: pusher && pusher.email
5757
? pusher.email
5858
: `${process.env.GITHUB_ACTOR || 'github-pages-deploy-action'}@users.noreply.${process.env.GITHUB_SERVER_URL
59-
? util_1.stripProtocolFromUrl(process.env.GITHUB_SERVER_URL)
59+
? (0, util_1.stripProtocolFromUrl)(process.env.GITHUB_SERVER_URL)
6060
: 'github.com'}`,
61-
name: !util_1.isNullOrUndefined(core_1.getInput('git-config-name'))
62-
? core_1.getInput('git-config-name')
61+
name: !(0, util_1.isNullOrUndefined)((0, core_1.getInput)('git-config-name'))
62+
? (0, core_1.getInput)('git-config-name')
6363
: pusher && pusher.name
6464
? pusher.name
6565
: process.env.GITHUB_ACTOR
6666
? process.env.GITHUB_ACTOR
6767
: 'GitHub Pages Deploy Action',
68-
repositoryName: !util_1.isNullOrUndefined(core_1.getInput('repository-name'))
69-
? core_1.getInput('repository-name')
68+
repositoryName: !(0, util_1.isNullOrUndefined)((0, core_1.getInput)('repository-name'))
69+
? (0, core_1.getInput)('repository-name')
7070
: repository && repository.full_name
7171
? repository.full_name
7272
: process.env.GITHUB_REPOSITORY,
73-
token: core_1.getInput('token'),
74-
singleCommit: !util_1.isNullOrUndefined(core_1.getInput('single-commit'))
75-
? core_1.getInput('single-commit').toLowerCase() === 'true'
73+
token: (0, core_1.getInput)('token'),
74+
singleCommit: !(0, util_1.isNullOrUndefined)((0, core_1.getInput)('single-commit'))
75+
? (0, core_1.getInput)('single-commit').toLowerCase() === 'true'
7676
: false,
77-
silent: !util_1.isNullOrUndefined(core_1.getInput('silent'))
78-
? core_1.getInput('silent').toLowerCase() === 'true'
77+
silent: !(0, util_1.isNullOrUndefined)((0, core_1.getInput)('silent'))
78+
? (0, core_1.getInput)('silent').toLowerCase() === 'true'
7979
: false,
80-
sshKey: util_1.isNullOrUndefined(core_1.getInput('ssh-key'))
80+
sshKey: (0, util_1.isNullOrUndefined)((0, core_1.getInput)('ssh-key'))
8181
? false
82-
: !util_1.isNullOrUndefined(core_1.getInput('ssh-key')) &&
83-
core_1.getInput('ssh-key').toLowerCase() === 'true'
82+
: !(0, util_1.isNullOrUndefined)((0, core_1.getInput)('ssh-key')) &&
83+
(0, core_1.getInput)('ssh-key').toLowerCase() === 'true'
8484
? true
85-
: core_1.getInput('ssh-key'),
86-
targetFolder: core_1.getInput('target-folder'),
85+
: (0, core_1.getInput)('ssh-key'),
86+
targetFolder: (0, core_1.getInput)('target-folder'),
8787
workspace: process.env.GITHUB_WORKSPACE || ''
8888
};
8989
/** Status codes for the action. */

lib/execute.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ let output = '';
2626
function execute(cmd, cwd, silent) {
2727
return __awaiter(this, void 0, void 0, function* () {
2828
output = '';
29-
yield exec_1.exec(cmd, [], {
29+
yield (0, exec_1.exec)(cmd, [], {
3030
// Silences the input unless the INPUT_DEBUG flag is set.
3131
silent,
3232
cwd,

lib/git.js

Lines changed: 32 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -24,38 +24,38 @@ const util_1 = require("./util");
2424
function init(action) {
2525
return __awaiter(this, void 0, void 0, function* () {
2626
try {
27-
core_1.info(`Deploying using ${action.tokenType}… 🔑`);
28-
core_1.info('Configuring git…');
29-
yield execute_1.execute(`git config user.name "${action.name}"`, action.workspace, action.silent);
30-
yield execute_1.execute(`git config user.email "${action.email}"`, action.workspace, action.silent);
27+
(0, core_1.info)(`Deploying using ${action.tokenType}… 🔑`);
28+
(0, core_1.info)('Configuring git…');
29+
yield (0, execute_1.execute)(`git config user.name "${action.name}"`, action.workspace, action.silent);
30+
yield (0, execute_1.execute)(`git config user.email "${action.email ? action.email : '<>'}"`, action.workspace, action.silent);
3131
try {
3232
if ((process.env.CI && !action.sshKey) || action.isTest) {
3333
/* Ensures that previously set Git configs do not interfere with the deployment.
3434
Only runs in the GitHub Actions CI environment if a user is not using an SSH key.
3535
*/
36-
yield execute_1.execute(`git config --local --unset-all http.https://${action.hostname}/.extraheader`, action.workspace, action.silent);
36+
yield (0, execute_1.execute)(`git config --local --unset-all http.https://${action.hostname}/.extraheader`, action.workspace, action.silent);
3737
}
3838
if (action.isTest === constants_1.TestFlag.UNABLE_TO_UNSET_GIT_CONFIG) {
3939
throw new Error();
4040
}
4141
}
4242
catch (_a) {
43-
core_1.info('Unable to unset previous git config authentication as it may not exist, continuing…');
43+
(0, core_1.info)('Unable to unset previous git config authentication as it may not exist, continuing…');
4444
}
4545
try {
46-
yield execute_1.execute(`git remote rm origin`, action.workspace, action.silent);
46+
yield (0, execute_1.execute)(`git remote rm origin`, action.workspace, action.silent);
4747
if (action.isTest === constants_1.TestFlag.UNABLE_TO_REMOVE_ORIGIN) {
4848
throw new Error();
4949
}
5050
}
5151
catch (_b) {
52-
core_1.info('Attempted to remove origin but failed, continuing…');
52+
(0, core_1.info)('Attempted to remove origin but failed, continuing…');
5353
}
54-
yield execute_1.execute(`git remote add origin ${action.repositoryPath}`, action.workspace, action.silent);
55-
core_1.info('Git configured… 🔧');
54+
yield (0, execute_1.execute)(`git remote add origin ${action.repositoryPath}`, action.workspace, action.silent);
55+
(0, core_1.info)('Git configured… 🔧');
5656
}
5757
catch (error) {
58-
throw new Error(`There was an error initializing the repository: ${util_1.suppressSensitiveInformation(error.message, action)} ❌`);
58+
throw new Error(`There was an error initializing the repository: ${(0, util_1.suppressSensitiveInformation)((0, util_1.extractErrorMessage)(error), action)} ❌`);
5959
}
6060
});
6161
}
@@ -67,17 +67,17 @@ function deploy(action) {
6767
const temporaryDeploymentBranch = `github-pages-deploy-action/${Math.random()
6868
.toString(36)
6969
.substr(2, 9)}`;
70-
core_1.info('Starting to commit changes…');
70+
(0, core_1.info)('Starting to commit changes…');
7171
try {
72-
const commitMessage = !util_1.isNullOrUndefined(action.commitMessage)
72+
const commitMessage = !(0, util_1.isNullOrUndefined)(action.commitMessage)
7373
? action.commitMessage
7474
: `Deploying to ${action.branch}${process.env.GITHUB_SHA
7575
? ` from @ ${process.env.GITHUB_REPOSITORY}@${process.env.GITHUB_SHA}`
7676
: ''} 🚀`;
7777
// Checks to see if the remote exists prior to deploying.
7878
const branchExists = action.isTest & constants_1.TestFlag.HAS_REMOTE_BRANCH ||
79-
(yield execute_1.execute(`git ls-remote --heads ${action.repositoryPath} refs/heads/${action.branch}`, action.workspace, action.silent));
80-
yield worktree_1.generateWorktree(action, temporaryDeploymentDirectory, branchExists);
79+
(yield (0, execute_1.execute)(`git ls-remote --heads ${action.repositoryPath} refs/heads/${action.branch}`, action.workspace, action.silent));
80+
yield (0, worktree_1.generateWorktree)(action, temporaryDeploymentDirectory, branchExists);
8181
// Ensures that items that need to be excluded from the clean job get parsed.
8282
let excludes = '';
8383
if (action.clean && action.cleanExclude) {
@@ -86,14 +86,14 @@ function deploy(action) {
8686
}
8787
}
8888
if (action.targetFolder) {
89-
core_1.info(`Creating target folder if it doesn't already exist… 📌`);
90-
yield io_1.mkdirP(`${temporaryDeploymentDirectory}/${action.targetFolder}`);
89+
(0, core_1.info)(`Creating target folder if it doesn't already exist… 📌`);
90+
yield (0, io_1.mkdirP)(`${temporaryDeploymentDirectory}/${action.targetFolder}`);
9191
}
9292
/*
9393
Pushes all of the build files into the deployment directory.
9494
Allows the user to specify the root if '.' is provided.
9595
rsync is used to prevent file duplication. */
96-
yield execute_1.execute(`rsync -q -av --checksum --progress ${action.folderPath}/. ${action.targetFolder
96+
yield (0, execute_1.execute)(`rsync -q -av --checksum --progress ${action.folderPath}/. ${action.targetFolder
9797
? `${temporaryDeploymentDirectory}/${action.targetFolder}`
9898
: temporaryDeploymentDirectory} ${action.clean
9999
? `--delete ${excludes} ${!fs_1.default.existsSync(`${action.folderPath}/CNAME`)
@@ -105,7 +105,7 @@ function deploy(action) {
105105
? `--exclude ${temporaryDeploymentDirectory}`
106106
: ''}`, action.workspace, action.silent);
107107
if (action.singleCommit) {
108-
yield execute_1.execute(`git add --all .`, `${action.workspace}/${temporaryDeploymentDirectory}`, action.silent);
108+
yield (0, execute_1.execute)(`git add --all .`, `${action.workspace}/${temporaryDeploymentDirectory}`, action.silent);
109109
}
110110
// Use git status to check if we have something to commit.
111111
// Special case is singleCommit with existing history, when
@@ -114,34 +114,35 @@ function deploy(action) {
114114
const checkGitStatus = branchExists && action.singleCommit
115115
? `git diff origin/${action.branch}`
116116
: `git status --porcelain`;
117-
core_1.info(`Checking if there are files to commit…`);
117+
(0, core_1.info)(`Checking if there are files to commit…`);
118118
const hasFilesToCommit = action.isTest & constants_1.TestFlag.HAS_CHANGED_FILES ||
119-
(yield execute_1.execute(checkGitStatus, `${action.workspace}/${temporaryDeploymentDirectory}`, true // This output is always silenced due to the large output it creates.
119+
(yield (0, execute_1.execute)(checkGitStatus, `${action.workspace}/${temporaryDeploymentDirectory}`, true // This output is always silenced due to the large output it creates.
120120
));
121121
if ((!action.singleCommit && !hasFilesToCommit) ||
122122
// Ignores the case where single commit is true with a target folder to prevent incorrect early exiting.
123123
(action.singleCommit && !action.targetFolder && !hasFilesToCommit)) {
124124
return constants_1.Status.SKIPPED;
125125
}
126126
// Commits to GitHub.
127-
yield execute_1.execute(`git add --all .`, `${action.workspace}/${temporaryDeploymentDirectory}`, action.silent);
128-
yield execute_1.execute(`git checkout -b ${temporaryDeploymentBranch}`, `${action.workspace}/${temporaryDeploymentDirectory}`, action.silent);
129-
yield execute_1.execute(`git commit -m "${commitMessage}" --quiet --no-verify`, `${action.workspace}/${temporaryDeploymentDirectory}`, action.silent);
127+
yield (0, execute_1.execute)(`git add --all .`, `${action.workspace}/${temporaryDeploymentDirectory}`, action.silent);
128+
yield (0, execute_1.execute)(`git checkout -b ${temporaryDeploymentBranch}`, `${action.workspace}/${temporaryDeploymentDirectory}`, action.silent);
129+
yield (0, execute_1.execute)(`git commit -m "${commitMessage}" --quiet --no-verify`, `${action.workspace}/${temporaryDeploymentDirectory}`, action.silent);
130130
if (!action.dryRun) {
131-
yield execute_1.execute(`git push --force ${action.repositoryPath} ${temporaryDeploymentBranch}:${action.branch}`, `${action.workspace}/${temporaryDeploymentDirectory}`, action.silent);
131+
yield (0, execute_1.execute)(`git push --force ${action.repositoryPath} ${temporaryDeploymentBranch}:${action.branch}`, `${action.workspace}/${temporaryDeploymentDirectory}`, action.silent);
132132
}
133-
core_1.info(`Changes committed to the ${action.branch} branch… 📦`);
133+
(0, core_1.info)(`Changes committed to the ${action.branch} branch… 📦`);
134134
return constants_1.Status.SUCCESS;
135135
}
136136
catch (error) {
137-
throw new Error(`The deploy step encountered an error: ${util_1.suppressSensitiveInformation(error.message, action)} ❌`);
137+
throw new Error(`The deploy step encountered an error: ${(0, util_1.suppressSensitiveInformation)((0, util_1.extractErrorMessage)(error), action)} ❌`);
138138
}
139139
finally {
140140
// Cleans up temporary files/folders and restores the git state.
141-
core_1.info('Running post deployment cleanup jobs… 🗑️');
142-
yield execute_1.execute(`git checkout -B ${temporaryDeploymentBranch}`, `${action.workspace}/${temporaryDeploymentDirectory}`, action.silent);
143-
yield execute_1.execute(`git worktree remove ${temporaryDeploymentDirectory} --force`, action.workspace, action.silent);
144-
yield io_1.rmRF(temporaryDeploymentDirectory);
141+
(0, core_1.info)('Running post deployment cleanup jobs… 🗑️');
142+
yield (0, execute_1.execute)(`git checkout -B ${temporaryDeploymentBranch}`, `${action.workspace}/${temporaryDeploymentDirectory}`, action.silent);
143+
yield (0, execute_1.execute)(`chmod -R 777 ${temporaryDeploymentDirectory}`, action.workspace, action.silent);
144+
yield (0, execute_1.execute)(`git worktree remove ${temporaryDeploymentDirectory} --force`, action.workspace, action.silent);
145+
yield (0, io_1.rmRF)(temporaryDeploymentDirectory);
145146
}
146147
});
147148
}

lib/lib.js

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ function run(configuration) {
2222
return __awaiter(this, void 0, void 0, function* () {
2323
let status = constants_1.Status.RUNNING;
2424
try {
25-
core_1.info(`
25+
(0, core_1.info)(`
2626
GitHub Pages Deploy Action 🚀
2727
2828
🚀 Getting Started Guide: https://github.com/marketplace/actions/deploy-to-github-pages
@@ -31,32 +31,32 @@ function run(configuration) {
3131
3232
📣 Maintained by James Ives: https://jamesiv.es
3333
💖 Support: https://github.com/sponsors/JamesIves`);
34-
core_1.info('Checking configuration and starting deployment… 🚦');
34+
(0, core_1.info)('Checking configuration and starting deployment… 🚦');
3535
const settings = Object.assign({}, configuration);
3636
// Defines the repository/folder paths and token types.
3737
// Also verifies that the action has all of the required parameters.
38-
settings.folderPath = util_1.generateFolderPath(settings);
39-
util_1.checkParameters(settings);
40-
settings.repositoryPath = util_1.generateRepositoryPath(settings);
41-
settings.tokenType = util_1.generateTokenType(settings);
38+
settings.folderPath = (0, util_1.generateFolderPath)(settings);
39+
(0, util_1.checkParameters)(settings);
40+
settings.repositoryPath = (0, util_1.generateRepositoryPath)(settings);
41+
settings.tokenType = (0, util_1.generateTokenType)(settings);
4242
if (settings.sshKey) {
43-
yield ssh_1.configureSSH(settings);
43+
yield (0, ssh_1.configureSSH)(settings);
4444
}
45-
yield git_1.init(settings);
46-
status = yield git_1.deploy(settings);
45+
yield (0, git_1.init)(settings);
46+
status = yield (0, git_1.deploy)(settings);
4747
}
4848
catch (error) {
4949
status = constants_1.Status.FAILED;
50-
core_1.setFailed(error.message);
50+
(0, core_1.setFailed)((0, util_1.extractErrorMessage)(error));
5151
}
5252
finally {
53-
core_1.info(`${status === constants_1.Status.FAILED
53+
(0, core_1.info)(`${status === constants_1.Status.FAILED
5454
? 'Deployment failed! ❌'
5555
: status === constants_1.Status.SUCCESS
5656
? 'Completed deployment successfully! ✅'
5757
: 'There is nothing to commit. Exiting early… 📭'}`);
58-
core_1.exportVariable('deployment_status', status);
59-
core_1.setOutput('deployment-status', status);
58+
(0, core_1.exportVariable)('deployment_status', status);
59+
(0, core_1.setOutput)('deployment-status', status);
6060
}
6161
});
6262
}

lib/main.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@ Object.defineProperty(exports, "__esModule", { value: true });
66
const constants_1 = require("./constants");
77
const lib_1 = __importDefault(require("./lib"));
88
// Runs the action within the GitHub actions environment.
9-
lib_1.default(constants_1.action);
9+
(0, lib_1.default)(constants_1.action);

0 commit comments

Comments
 (0)