Skip to content

Commit

Permalink
Deploy Production Code for Commit 432c473 🚀
Browse files Browse the repository at this point in the history
  • Loading branch information
JamesIves committed Oct 13, 2022
1 parent 432c473 commit ba14867
Show file tree
Hide file tree
Showing 169 changed files with 42,553 additions and 370 deletions.
2 changes: 1 addition & 1 deletion lib/constants.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export interface ActionInterface {
name?: string;
/** The repository path, for example JamesIves/github-pages-deploy-action. */
repositoryName?: string;
/** The fully qualified repositpory path, this gets auto generated if repositoryName is provided. */
/** The fully qualified repository path, this gets auto generated if repositoryName is provided. */
repositoryPath?: string;
/** Wipes the commit history from the deployment branch in favor of a single commit. */
singleCommit?: boolean | null;
Expand Down
6 changes: 6 additions & 0 deletions lib/git.d.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
import { ActionInterface, Status } from './constants';
/**
* Initializes git in the workspace.
*/
export declare function init(action: ActionInterface): Promise<void | Error>;
/**
* Runs the necessary steps to make the deployment.
*/
export declare function deploy(action: ActionInterface): Promise<Status>;
8 changes: 6 additions & 2 deletions lib/git.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ const constants_1 = require("./constants");
const execute_1 = require("./execute");
const worktree_1 = require("./worktree");
const util_1 = require("./util");
/* Initializes git in the workspace. */
/**
* Initializes git in the workspace.
*/
function init(action) {
return __awaiter(this, void 0, void 0, function* () {
try {
Expand Down Expand Up @@ -67,7 +69,9 @@ function init(action) {
});
}
exports.init = init;
/* Runs the necessary steps to make the deployment. */
/**
* Runs the necessary steps to make the deployment.
*/
function deploy(action) {
return __awaiter(this, void 0, void 0, function* () {
const temporaryDeploymentDirectory = 'github-pages-deploy-action-temp-deployment-folder';
Expand Down
3 changes: 3 additions & 0 deletions lib/ssh.d.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
import { ActionInterface } from './constants';
/**
* Configures SSH for the workflow.
*/
export declare function configureSSH(action: ActionInterface): Promise<void>;
3 changes: 3 additions & 0 deletions lib/ssh.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ const io_1 = require("@actions/io");
const child_process_1 = require("child_process");
const fs_1 = require("fs");
const util_1 = require("./util");
/**
* Configures SSH for the workflow.
*/
function configureSSH(action) {
return __awaiter(this, void 0, void 0, function* () {
try {
Expand Down
26 changes: 25 additions & 1 deletion lib/util.d.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,34 @@
import { ActionInterface } from './constants';
/**
* Utility function that checks to see if a value is undefined or not.
* If allowEmptyString is passed the parameter is allowed to contain an empty string as a valid parameter.
*/
export declare const isNullOrUndefined: (value: unknown) => value is "" | null | undefined;
/**
* Generates a token type used for the action.
*/
export declare const generateTokenType: (action: ActionInterface) => string;
/**
* Generates a the repository path used to make the commits.
*/
export declare const generateRepositoryPath: (action: ActionInterface) => string;
/**
* Generate absolute folder path by the provided folder name
*/
export declare const generateFolderPath: (action: ActionInterface) => string;
/**
* Verifies the action has the required parameters to run, otherwise throw an error.
*/
export declare const checkParameters: (action: ActionInterface) => void;
/**
* Suppresses sensitive information from being exposed in error messages.
*/
export declare const suppressSensitiveInformation: (str: string, action: ActionInterface) => string;
/**
* Extracts message from an error object.
*/
export declare const extractErrorMessage: (error: unknown) => string;
/** Strips the protocol from a provided URL. */
/**
* Strips the protocol from a provided URL.
*/
export declare const stripProtocolFromUrl: (url: string) => string;
41 changes: 31 additions & 10 deletions lib/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,31 @@ const core_1 = require("@actions/core");
const fs_1 = require("fs");
const path_1 = __importDefault(require("path"));
const constants_1 = require("./constants");
/* Replaces all instances of a match in a string. */
/**
* Replaces all instances of a match in a string.
*/
const replaceAll = (input, find, replace) => input.split(find).join(replace);
/* Utility function that checks to see if a value is undefined or not.
If allowEmptyString is passed the parameter is allowed to contain an empty string as a valid parameter. */
/**
* Utility function that checks to see if a value is undefined or not.
* If allowEmptyString is passed the parameter is allowed to contain an empty string as a valid parameter.
*/
const isNullOrUndefined = (value) => typeof value === 'undefined' || value === null || value === '';
exports.isNullOrUndefined = isNullOrUndefined;
/* Generates a token type used for the action. */
/**
* Generates a token type used for the action.
*/
const generateTokenType = (action) => action.sshKey ? 'SSH Deploy Key' : action.token ? 'Deploy Token' : '…';
exports.generateTokenType = generateTokenType;
/* Generates a the repository path used to make the commits. */
/**
* Generates a the repository path used to make the commits.
*/
const generateRepositoryPath = (action) => action.sshKey
? `git@${action.hostname}:${action.repositoryName}`
: `https://${`x-access-token:${action.token}`}@${action.hostname}/${action.repositoryName}.git`;
exports.generateRepositoryPath = generateRepositoryPath;
/* Genetate absolute folder path by the provided folder name */
/**
* Generate absolute folder path by the provided folder name
*/
const generateFolderPath = (action) => {
const folderName = action['folder'];
return path_1.default.isAbsolute(folderName)
Expand All @@ -32,12 +42,16 @@ const generateFolderPath = (action) => {
: path_1.default.join(action.workspace, folderName);
};
exports.generateFolderPath = generateFolderPath;
/* Checks for the required tokens and formatting. Throws an error if any case is matched. */
/**
* Checks for the required tokens and formatting. Throws an error if any case is matched.
*/
const hasRequiredParameters = (action, params) => {
const nonNullParams = params.filter(param => !(0, exports.isNullOrUndefined)(action[param]));
return Boolean(nonNullParams.length);
};
/* Verifies the action has the required parameters to run, otherwise throw an error. */
/**
* Verifies the action has the required parameters to run, otherwise throw an error.
*/
const checkParameters = (action) => {
if (!hasRequiredParameters(action, ['token', 'sshKey'])) {
throw new Error('No deployment token/method was provided. You must provide the action with either a Personal Access Token or the GitHub Token secret in order to deploy. For more details on how to use an ssh deploy key please refer to the documentation.');
Expand All @@ -56,7 +70,9 @@ const checkParameters = (action) => {
}
};
exports.checkParameters = checkParameters;
/* Suppresses sensitive information from being exposed in error messages. */
/**
* Suppresses sensitive information from being exposed in error messages.
*/
const suppressSensitiveInformation = (str, action) => {
let value = str;
if ((0, core_1.isDebug)()) {
Expand All @@ -70,12 +86,17 @@ const suppressSensitiveInformation = (str, action) => {
return value;
};
exports.suppressSensitiveInformation = suppressSensitiveInformation;
/**
* Extracts message from an error object.
*/
const extractErrorMessage = (error) => error instanceof Error
? error.message
: typeof error == 'string'
? error
: JSON.stringify(error);
exports.extractErrorMessage = extractErrorMessage;
/** Strips the protocol from a provided URL. */
/**
* Strips the protocol from a provided URL.
*/
const stripProtocolFromUrl = (url) => url.replace(/^(?:https?:\/\/)?(?:www\.)?/i, '').split('/')[0];
exports.stripProtocolFromUrl = stripProtocolFromUrl;
3 changes: 3 additions & 0 deletions lib/worktree.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,7 @@ export declare class GitCheckout {
constructor(branch: string);
toString(): string;
}
/**
* Generate the worktree and set initial content if it exists
*/
export declare function generateWorktree(action: ActionInterface, worktreedir: string, branchExists: unknown): Promise<void>;
4 changes: 3 additions & 1 deletion lib/worktree.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@ class GitCheckout {
}
}
exports.GitCheckout = GitCheckout;
/* Generate the worktree and set initial content if it exists */
/**
* Generate the worktree and set initial content if it exists
*/
function generateWorktree(action, worktreedir, branchExists) {
return __awaiter(this, void 0, void 0, function* () {
try {
Expand Down
1 change: 1 addition & 0 deletions node_modules/.bin/uuid

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

27 changes: 17 additions & 10 deletions node_modules/@actions/core/lib/core.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit ba14867

Please sign in to comment.