Skip to content

Commit eb3eb01

Browse files
committed
build
1 parent 1c6c498 commit eb3eb01

File tree

13,883 files changed

+2324831
-84
lines changed

Some content is hidden

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

13,883 files changed

+2324831
-84
lines changed

.gitignore

+3-3
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_modules
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
@@ -29,4 +29,4 @@ coverage
2929
.yarn-integrity
3030

3131
# Dot Env
32-
.env
32+
.env

lib/constants.d.ts

+96
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
export declare enum TestFlag {
2+
NONE = 0,
3+
HAS_CHANGED_FILES = 2,// Assume changes to commit.
4+
HAS_REMOTE_BRANCH = 4,// Assume remote repository has existing commits.
5+
UNABLE_TO_REMOVE_ORIGIN = 8,// Assume we can't remove origin.
6+
UNABLE_TO_UNSET_GIT_CONFIG = 16,// Assume we can't remove previously set git configs.
7+
HAS_REJECTED_COMMIT = 32
8+
}
9+
export interface ActionInterface {
10+
/** The branch that the action should deploy to. */
11+
branch: string;
12+
/** git push with --dry-run */
13+
dryRun?: boolean | null;
14+
/** 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. */
15+
clean?: boolean | null;
16+
/** If you need to use CLEAN but you'd like to preserve certain files or folders you can use this option. */
17+
cleanExclude?: string[];
18+
/** If you need to customize the commit message for an integration you can do so. */
19+
commitMessage?: string;
20+
/** The hostname of which the GitHub Workflow is being run on, ie: github.com */
21+
hostname?: string;
22+
/** The git config email. */
23+
email?: string;
24+
/** The folder to deploy. */
25+
folder: string;
26+
/** The auto generated folder path. */
27+
folderPath?: string;
28+
/** Whether to force-push or attempt to merge existing changes. */
29+
force?: boolean;
30+
/** Determines test scenarios the action is running in. */
31+
isTest: TestFlag;
32+
/** The git config name. */
33+
name?: string;
34+
/** The repository path, for example JamesIves/github-pages-deploy-action. */
35+
repositoryName?: string;
36+
/** The fully qualified repository path, this gets auto generated if repositoryName is provided. */
37+
repositoryPath?: string;
38+
/** Wipes the commit history from the deployment branch in favor of a single commit. */
39+
singleCommit?: boolean | null;
40+
/** Determines if the action should run in silent mode or not. */
41+
silent: boolean;
42+
/** 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. */
43+
sshKey?: string | boolean | null;
44+
/** 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. */
45+
targetFolder?: string;
46+
/** Deployment token. */
47+
token?: string | null;
48+
/** The token type, ie ssh/token, this gets automatically generated. */
49+
tokenType?: string;
50+
/** The folder where your deployment project lives. */
51+
workspace: string;
52+
/** GitHub tag name */
53+
tag?: string | null;
54+
}
55+
/** The minimum required values to run the action as a node module. */
56+
export interface NodeActionInterface {
57+
/** The branch that the action should deploy to. */
58+
branch?: string;
59+
/** The folder to deploy. */
60+
folder: string;
61+
/** The repository path, for example JamesIves/github-pages-deploy-action. */
62+
repositoryName: string;
63+
/** GitHub deployment token. */
64+
token?: string | null;
65+
/** Determines if the action should run in silent mode or not. */
66+
silent: boolean;
67+
/** 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. */
68+
sshKey?: string | boolean | null;
69+
/** The folder where your deployment project lives. */
70+
workspace: string;
71+
/** Determines test scenarios the action is running in. */
72+
isTest: TestFlag;
73+
}
74+
export declare const action: ActionInterface;
75+
/** Types for the required action parameters. */
76+
export type RequiredActionParameters = Pick<ActionInterface, 'token' | 'sshKey' | 'branch' | 'folder' | 'isTest'>;
77+
/** Status codes for the action. */
78+
export declare enum Status {
79+
SUCCESS = "success",
80+
FAILED = "failed",
81+
SKIPPED = "skipped",
82+
RUNNING = "running"
83+
}
84+
export declare enum OperatingSystems {
85+
LINUX = "Linux",
86+
WINDOWS = "Windows",
87+
MACOS = "macOS"
88+
}
89+
export declare const SupportedOperatingSystems: OperatingSystems[];
90+
export declare enum DefaultExcludedFiles {
91+
CNAME = "CNAME",
92+
NOJEKYLL = ".nojekyll",
93+
SSH = ".ssh",
94+
GIT = ".git",
95+
GITHUB = ".github"
96+
}

lib/constants.js

+124
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
"use strict";
2+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3+
if (k2 === undefined) k2 = k;
4+
var desc = Object.getOwnPropertyDescriptor(m, k);
5+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6+
desc = { enumerable: true, get: function() { return m[k]; } };
7+
}
8+
Object.defineProperty(o, k2, desc);
9+
}) : (function(o, m, k, k2) {
10+
if (k2 === undefined) k2 = k;
11+
o[k2] = m[k];
12+
}));
13+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14+
Object.defineProperty(o, "default", { enumerable: true, value: v });
15+
}) : function(o, v) {
16+
o["default"] = v;
17+
});
18+
var __importStar = (this && this.__importStar) || function (mod) {
19+
if (mod && mod.__esModule) return mod;
20+
var result = {};
21+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22+
__setModuleDefault(result, mod);
23+
return result;
24+
};
25+
Object.defineProperty(exports, "__esModule", { value: true });
26+
exports.DefaultExcludedFiles = exports.SupportedOperatingSystems = exports.OperatingSystems = exports.Status = exports.action = exports.TestFlag = void 0;
27+
const core_1 = require("@actions/core");
28+
const github = __importStar(require("@actions/github"));
29+
const util_1 = require("./util");
30+
const { pusher, repository } = github.context.payload;
31+
/*
32+
* Flags to signal different scenarios to test cases
33+
*/
34+
var TestFlag;
35+
(function (TestFlag) {
36+
TestFlag[TestFlag["NONE"] = 0] = "NONE";
37+
TestFlag[TestFlag["HAS_CHANGED_FILES"] = 2] = "HAS_CHANGED_FILES";
38+
TestFlag[TestFlag["HAS_REMOTE_BRANCH"] = 4] = "HAS_REMOTE_BRANCH";
39+
TestFlag[TestFlag["UNABLE_TO_REMOVE_ORIGIN"] = 8] = "UNABLE_TO_REMOVE_ORIGIN";
40+
TestFlag[TestFlag["UNABLE_TO_UNSET_GIT_CONFIG"] = 16] = "UNABLE_TO_UNSET_GIT_CONFIG";
41+
TestFlag[TestFlag["HAS_REJECTED_COMMIT"] = 32] = "HAS_REJECTED_COMMIT"; // Assume commit rejection.
42+
})(TestFlag || (exports.TestFlag = TestFlag = {}));
43+
/* Required action data that gets initialized when running within the GitHub Actions environment. */
44+
exports.action = {
45+
folder: (0, core_1.getInput)('folder'),
46+
branch: (0, core_1.getInput)('branch'),
47+
commitMessage: (0, core_1.getInput)('commit-message'),
48+
dryRun: !(0, util_1.isNullOrUndefined)((0, core_1.getInput)('dry-run'))
49+
? (0, core_1.getInput)('dry-run').toLowerCase() === 'true'
50+
: false,
51+
force: !(0, util_1.isNullOrUndefined)((0, core_1.getInput)('force'))
52+
? (0, core_1.getInput)('force').toLowerCase() === 'true'
53+
: true,
54+
clean: !(0, util_1.isNullOrUndefined)((0, core_1.getInput)('clean'))
55+
? (0, core_1.getInput)('clean').toLowerCase() === 'true'
56+
: false,
57+
cleanExclude: ((0, core_1.getInput)('clean-exclude') || '')
58+
.split('\n')
59+
.filter(l => l !== ''),
60+
hostname: process.env.GITHUB_SERVER_URL
61+
? (0, util_1.stripProtocolFromUrl)(process.env.GITHUB_SERVER_URL)
62+
: 'github.com',
63+
isTest: TestFlag.NONE,
64+
email: !(0, util_1.isNullOrUndefined)((0, core_1.getInput)('git-config-email'))
65+
? (0, core_1.getInput)('git-config-email')
66+
: pusher && pusher.email
67+
? pusher.email
68+
: `${process.env.GITHUB_ACTOR || 'github-pages-deploy-action'}@users.noreply.${process.env.GITHUB_SERVER_URL
69+
? (0, util_1.stripProtocolFromUrl)(process.env.GITHUB_SERVER_URL)
70+
: 'github.com'}`,
71+
name: !(0, util_1.isNullOrUndefined)((0, core_1.getInput)('git-config-name'))
72+
? (0, core_1.getInput)('git-config-name')
73+
: pusher && pusher.name
74+
? pusher.name
75+
: process.env.GITHUB_ACTOR
76+
? process.env.GITHUB_ACTOR
77+
: 'GitHub Pages Deploy Action',
78+
repositoryName: !(0, util_1.isNullOrUndefined)((0, core_1.getInput)('repository-name'))
79+
? (0, core_1.getInput)('repository-name')
80+
: repository && repository.full_name
81+
? repository.full_name
82+
: process.env.GITHUB_REPOSITORY,
83+
token: (0, core_1.getInput)('token'),
84+
singleCommit: !(0, util_1.isNullOrUndefined)((0, core_1.getInput)('single-commit'))
85+
? (0, core_1.getInput)('single-commit').toLowerCase() === 'true'
86+
: false,
87+
silent: !(0, util_1.isNullOrUndefined)((0, core_1.getInput)('silent'))
88+
? (0, core_1.getInput)('silent').toLowerCase() === 'true'
89+
: false,
90+
sshKey: (0, util_1.isNullOrUndefined)((0, core_1.getInput)('ssh-key'))
91+
? false
92+
: !(0, util_1.isNullOrUndefined)((0, core_1.getInput)('ssh-key')) &&
93+
(0, core_1.getInput)('ssh-key').toLowerCase() === 'true'
94+
? true
95+
: (0, core_1.getInput)('ssh-key'),
96+
targetFolder: (0, core_1.getInput)('target-folder'),
97+
workspace: process.env.GITHUB_WORKSPACE || '',
98+
tag: (0, core_1.getInput)('tag')
99+
};
100+
/** Status codes for the action. */
101+
var Status;
102+
(function (Status) {
103+
Status["SUCCESS"] = "success";
104+
Status["FAILED"] = "failed";
105+
Status["SKIPPED"] = "skipped";
106+
Status["RUNNING"] = "running";
107+
})(Status || (exports.Status = Status = {}));
108+
/* Platform codes. */
109+
var OperatingSystems;
110+
(function (OperatingSystems) {
111+
OperatingSystems["LINUX"] = "Linux";
112+
OperatingSystems["WINDOWS"] = "Windows";
113+
OperatingSystems["MACOS"] = "macOS";
114+
})(OperatingSystems || (exports.OperatingSystems = OperatingSystems = {}));
115+
exports.SupportedOperatingSystems = [OperatingSystems.LINUX];
116+
/* Excluded files. */
117+
var DefaultExcludedFiles;
118+
(function (DefaultExcludedFiles) {
119+
DefaultExcludedFiles["CNAME"] = "CNAME";
120+
DefaultExcludedFiles["NOJEKYLL"] = ".nojekyll";
121+
DefaultExcludedFiles["SSH"] = ".ssh";
122+
DefaultExcludedFiles["GIT"] = ".git";
123+
DefaultExcludedFiles["GITHUB"] = ".github";
124+
})(DefaultExcludedFiles || (exports.DefaultExcludedFiles = DefaultExcludedFiles = {}));

lib/execute.d.ts

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
/**
2+
* The output of a command.
3+
*/
4+
type ExecuteOutput = {
5+
/**
6+
* The standard output of the command.
7+
*/
8+
stdout: string;
9+
/**
10+
* The standard error of the command.
11+
*/
12+
stderr: string;
13+
};
14+
/** Wrapper around the GitHub toolkit exec command which returns the output.
15+
* Also allows you to easily toggle the current working directory.
16+
*
17+
* @param {string} cmd - The command to execute.
18+
* @param {string} cwd - The current working directory.
19+
* @param {boolean} silent - Determines if the in/out should be silenced or not.
20+
* @param {boolean} ignoreReturnCode - Determines whether to throw an error
21+
* on a non-zero exit status or to leave implementation up to the caller.
22+
*/
23+
export declare function execute(cmd: string, cwd: string, silent: boolean, ignoreReturnCode?: boolean): Promise<ExecuteOutput>;
24+
/**
25+
* Writes the output of a command to the stdout buffer.
26+
*/
27+
export declare function stdout(data: Buffer | string): void;
28+
/**
29+
* Writes the output of a command to the stderr buffer.
30+
*/
31+
export declare function stderr(data: Buffer | string): void;
32+
export {};

lib/execute.js

+63
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
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.execute = execute;
16+
exports.stdout = stdout;
17+
exports.stderr = stderr;
18+
const exec_1 = require("@actions/exec");
19+
const buffer_1 = __importDefault(require("buffer"));
20+
const output = { stdout: '', stderr: '' };
21+
/** Wrapper around the GitHub toolkit exec command which returns the output.
22+
* Also allows you to easily toggle the current working directory.
23+
*
24+
* @param {string} cmd - The command to execute.
25+
* @param {string} cwd - The current working directory.
26+
* @param {boolean} silent - Determines if the in/out should be silenced or not.
27+
* @param {boolean} ignoreReturnCode - Determines whether to throw an error
28+
* on a non-zero exit status or to leave implementation up to the caller.
29+
*/
30+
function execute(cmd_1, cwd_1, silent_1) {
31+
return __awaiter(this, arguments, void 0, function* (cmd, cwd, silent, ignoreReturnCode = false) {
32+
output.stdout = '';
33+
output.stderr = '';
34+
yield (0, exec_1.exec)(cmd, [], {
35+
// Silences the input unless the INPUT_DEBUG flag is set.
36+
silent,
37+
cwd,
38+
listeners: { stdout, stderr },
39+
ignoreReturnCode
40+
});
41+
return Promise.resolve(output);
42+
});
43+
}
44+
/**
45+
* Writes the output of a command to the stdout buffer.
46+
*/
47+
function stdout(data) {
48+
const dataString = data.toString().trim();
49+
if (output.stdout.length + dataString.length <
50+
buffer_1.default.constants.MAX_STRING_LENGTH) {
51+
output.stdout += dataString;
52+
}
53+
}
54+
/**
55+
* Writes the output of a command to the stderr buffer.
56+
*/
57+
function stderr(data) {
58+
const dataString = data.toString().trim();
59+
if (output.stderr.length + dataString.length <
60+
buffer_1.default.constants.MAX_STRING_LENGTH) {
61+
output.stderr += dataString;
62+
}
63+
}

lib/git.d.ts

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import { ActionInterface, Status } from './constants';
2+
/**
3+
* Initializes git in the workspace.
4+
*/
5+
export declare function init(action: ActionInterface): Promise<void | Error>;
6+
/**
7+
* Runs the necessary steps to make the deployment.
8+
*/
9+
export declare function deploy(action: ActionInterface): Promise<Status>;

0 commit comments

Comments
 (0)