Skip to content

Commit 6ce741f

Browse files
committed
Deploy Production Code for Commit 36b163b 🚀
1 parent 36b163b commit 6ce741f

File tree

865 files changed

+318864
-2
lines changed

Some content is hidden

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

865 files changed

+318864
-2
lines changed

.gitignore

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@
55
npm-debug.log*
66
yarn-debug.log*
77
yarn-error.log*
8-
node_modules
8+
# node_moduless
99

1010
# Test Temp Files
1111
assets/.nojekyll
1212
assets/CNAME
1313

1414
# Build
15-
lib
15+
# lib
1616

1717
## Registry
1818
package-lock.json

lib/constants.d.ts

+78
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
export declare enum TestFlag {
2+
NONE = 0,
3+
HAS_CHANGED_FILES = 2,
4+
HAS_REMOTE_BRANCH = 4,
5+
UNABLE_TO_REMOVE_ORIGIN = 8,
6+
UNABLE_TO_UNSET_GIT_CONFIG = 16
7+
}
8+
export interface ActionInterface {
9+
/** The branch that the action should deploy to. */
10+
branch: string;
11+
/** git push with --dry-run */
12+
dryRun?: boolean | null;
13+
/** If your project generates hashed files on build you can use this option to automatically delete them from the deployment branch with each deploy. This option can be toggled on by setting it to true. */
14+
clean?: boolean | null;
15+
/** If you need to use CLEAN but you'd like to preserve certain files or folders you can use this option. */
16+
cleanExclude?: string[];
17+
/** If you need to customize the commit message for an integration you can do so. */
18+
commitMessage?: string;
19+
/** The hostname of which the GitHub Workflow is being run on, ie: github.com */
20+
hostname?: string;
21+
/** The git config email. */
22+
email?: string;
23+
/** The folder to deploy. */
24+
folder: string;
25+
/** The auto generated folder path. */
26+
folderPath?: string;
27+
/** Determines test scenarios the action is running in. */
28+
isTest: TestFlag;
29+
/** The git config name. */
30+
name?: string;
31+
/** The repository path, for example JamesIves/github-pages-deploy-action. */
32+
repositoryName?: string;
33+
/** The fully qualified repositpory path, this gets auto generated if repositoryName is provided. */
34+
repositoryPath?: string;
35+
/** Wipes the commit history from the deployment branch in favor of a single commit. */
36+
singleCommit?: boolean | null;
37+
/** Determines if the action should run in silent mode or not. */
38+
silent: boolean;
39+
/** Defines an SSH private key that can be used during deployment. This can also be set to true to use SSH deployment endpoints if you've already configured the SSH client outside of this package. */
40+
sshKey?: string | boolean | null;
41+
/** If you'd like to push the contents of the deployment folder into a specific directory on the deployment branch you can specify it here. */
42+
targetFolder?: string;
43+
/** Deployment token. */
44+
token?: string | null;
45+
/** The token type, ie ssh/token, this gets automatically generated. */
46+
tokenType?: string;
47+
/** The folder where your deployment project lives. */
48+
workspace: string;
49+
}
50+
/** The minimum required values to run the action as a node module. */
51+
export interface NodeActionInterface {
52+
/** The branch that the action should deploy to. */
53+
branch: string;
54+
/** The folder to deploy. */
55+
folder: string;
56+
/** The repository path, for example JamesIves/github-pages-deploy-action. */
57+
repositoryName: string;
58+
/** GitHub deployment token. */
59+
token?: string | null;
60+
/** Determines if the action should run in silent mode or not. */
61+
silent: boolean;
62+
/** Defines an SSH private key that can be used during deployment. This can also be set to true to use SSH deployment endpoints if you've already configured the SSH client outside of this package. */
63+
sshKey?: string | boolean | null;
64+
/** The folder where your deployment project lives. */
65+
workspace: string;
66+
/** Determines test scenarios the action is running in. */
67+
isTest: TestFlag;
68+
}
69+
export declare const action: ActionInterface;
70+
/** Types for the required action parameters. */
71+
export declare type RequiredActionParameters = Pick<ActionInterface, 'token' | 'sshKey' | 'branch' | 'folder' | 'isTest'>;
72+
/** Status codes for the action. */
73+
export declare enum Status {
74+
SUCCESS = "success",
75+
FAILED = "failed",
76+
SKIPPED = "skipped",
77+
RUNNING = "running"
78+
}

lib/constants.js

+96
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
"use strict";
2+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3+
if (k2 === undefined) k2 = k;
4+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5+
}) : (function(o, m, k, k2) {
6+
if (k2 === undefined) k2 = k;
7+
o[k2] = m[k];
8+
}));
9+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
10+
Object.defineProperty(o, "default", { enumerable: true, value: v });
11+
}) : function(o, v) {
12+
o["default"] = v;
13+
});
14+
var __importStar = (this && this.__importStar) || function (mod) {
15+
if (mod && mod.__esModule) return mod;
16+
var result = {};
17+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
18+
__setModuleDefault(result, mod);
19+
return result;
20+
};
21+
Object.defineProperty(exports, "__esModule", { value: true });
22+
exports.Status = exports.action = exports.TestFlag = void 0;
23+
const core_1 = require("@actions/core");
24+
const github = __importStar(require("@actions/github"));
25+
const util_1 = require("./util");
26+
const { pusher, repository } = github.context.payload;
27+
/* Flags to signal different scenarios to test cases */
28+
var TestFlag;
29+
(function (TestFlag) {
30+
TestFlag[TestFlag["NONE"] = 0] = "NONE";
31+
TestFlag[TestFlag["HAS_CHANGED_FILES"] = 2] = "HAS_CHANGED_FILES";
32+
TestFlag[TestFlag["HAS_REMOTE_BRANCH"] = 4] = "HAS_REMOTE_BRANCH";
33+
TestFlag[TestFlag["UNABLE_TO_REMOVE_ORIGIN"] = 8] = "UNABLE_TO_REMOVE_ORIGIN";
34+
TestFlag[TestFlag["UNABLE_TO_UNSET_GIT_CONFIG"] = 16] = "UNABLE_TO_UNSET_GIT_CONFIG"; // Assume we can't remove previously set git configs.
35+
})(TestFlag = exports.TestFlag || (exports.TestFlag = {}));
36+
/* Required action data that gets initialized when running within the GitHub Actions environment. */
37+
exports.action = {
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'
43+
: false,
44+
clean: !(0, util_1.isNullOrUndefined)((0, core_1.getInput)('clean'))
45+
? (0, core_1.getInput)('clean').toLowerCase() === 'true'
46+
: false,
47+
cleanExclude: ((0, core_1.getInput)('clean-exclude') || '')
48+
.split('\n')
49+
.filter(l => l !== ''),
50+
hostname: process.env.GITHUB_SERVER_URL
51+
? (0, util_1.stripProtocolFromUrl)(process.env.GITHUB_SERVER_URL)
52+
: 'github.com',
53+
isTest: TestFlag.NONE,
54+
email: !(0, util_1.isNullOrUndefined)((0, core_1.getInput)('git-config-email'))
55+
? (0, core_1.getInput)('git-config-email')
56+
: pusher && pusher.email
57+
? pusher.email
58+
: `${process.env.GITHUB_ACTOR || 'github-pages-deploy-action'}@users.noreply.${process.env.GITHUB_SERVER_URL
59+
? (0, util_1.stripProtocolFromUrl)(process.env.GITHUB_SERVER_URL)
60+
: 'github.com'}`,
61+
name: !(0, util_1.isNullOrUndefined)((0, core_1.getInput)('git-config-name'))
62+
? (0, core_1.getInput)('git-config-name')
63+
: pusher && pusher.name
64+
? pusher.name
65+
: process.env.GITHUB_ACTOR
66+
? process.env.GITHUB_ACTOR
67+
: 'GitHub Pages Deploy Action',
68+
repositoryName: !(0, util_1.isNullOrUndefined)((0, core_1.getInput)('repository-name'))
69+
? (0, core_1.getInput)('repository-name')
70+
: repository && repository.full_name
71+
? repository.full_name
72+
: process.env.GITHUB_REPOSITORY,
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'
76+
: false,
77+
silent: !(0, util_1.isNullOrUndefined)((0, core_1.getInput)('silent'))
78+
? (0, core_1.getInput)('silent').toLowerCase() === 'true'
79+
: false,
80+
sshKey: (0, util_1.isNullOrUndefined)((0, core_1.getInput)('ssh-key'))
81+
? false
82+
: !(0, util_1.isNullOrUndefined)((0, core_1.getInput)('ssh-key')) &&
83+
(0, core_1.getInput)('ssh-key').toLowerCase() === 'true'
84+
? true
85+
: (0, core_1.getInput)('ssh-key'),
86+
targetFolder: (0, core_1.getInput)('target-folder'),
87+
workspace: process.env.GITHUB_WORKSPACE || ''
88+
};
89+
/** Status codes for the action. */
90+
var Status;
91+
(function (Status) {
92+
Status["SUCCESS"] = "success";
93+
Status["FAILED"] = "failed";
94+
Status["SKIPPED"] = "skipped";
95+
Status["RUNNING"] = "running";
96+
})(Status = exports.Status || (exports.Status = {}));

lib/execute.d.ts

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
/// <reference types="node" />
2+
/** Wrapper around the GitHub toolkit exec command which returns the output.
3+
* Also allows you to easily toggle the current working directory.
4+
*
5+
* @param {string} cmd - The command to execute.
6+
* @param {string} cwd - The current working directory.
7+
* @param {boolean} silent - Determines if the in/out should be silenced or not.
8+
*/
9+
export declare function execute(cmd: string, cwd: string, silent: boolean): Promise<string>;
10+
export declare function stdout(data: Buffer | string): void;

lib/execute.js

+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
"use strict";
2+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4+
return new (P || (P = Promise))(function (resolve, reject) {
5+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8+
step((generator = generator.apply(thisArg, _arguments || [])).next());
9+
});
10+
};
11+
var __importDefault = (this && this.__importDefault) || function (mod) {
12+
return (mod && mod.__esModule) ? mod : { "default": mod };
13+
};
14+
Object.defineProperty(exports, "__esModule", { value: true });
15+
exports.stdout = exports.execute = void 0;
16+
const exec_1 = require("@actions/exec");
17+
const buffer_1 = __importDefault(require("buffer"));
18+
let output = '';
19+
/** Wrapper around the GitHub toolkit exec command which returns the output.
20+
* Also allows you to easily toggle the current working directory.
21+
*
22+
* @param {string} cmd - The command to execute.
23+
* @param {string} cwd - The current working directory.
24+
* @param {boolean} silent - Determines if the in/out should be silenced or not.
25+
*/
26+
function execute(cmd, cwd, silent) {
27+
return __awaiter(this, void 0, void 0, function* () {
28+
output = '';
29+
yield (0, exec_1.exec)(cmd, [], {
30+
// Silences the input unless the INPUT_DEBUG flag is set.
31+
silent,
32+
cwd,
33+
listeners: {
34+
stdout
35+
}
36+
});
37+
return Promise.resolve(output);
38+
});
39+
}
40+
exports.execute = execute;
41+
function stdout(data) {
42+
const dataString = data.toString().trim();
43+
if (output.length + dataString.length < buffer_1.default.constants.MAX_STRING_LENGTH) {
44+
output += dataString;
45+
}
46+
}
47+
exports.stdout = stdout;

lib/git.d.ts

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import { ActionInterface, Status } from './constants';
2+
export declare function init(action: ActionInterface): Promise<void | Error>;
3+
export declare function deploy(action: ActionInterface): Promise<Status>;

0 commit comments

Comments
 (0)