Skip to content

Commit

Permalink
3.7.0 🚀
Browse files Browse the repository at this point in the history
  • Loading branch information
JamesIves committed Oct 17, 2020
1 parent e45a9df commit 132898c
Show file tree
Hide file tree
Showing 9,697 changed files with 50,375 additions and 362,288 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
25 changes: 23 additions & 2 deletions lib/constants.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ export interface ActionInterface {
email?: string;
/** The folder to deploy. */
folder: string;
/** The auto generated folder path. */
folderPath?: string;
/** GitHub deployment token. */
gitHubToken?: string | null;
/** Determines if the action is running in test mode or not. */
Expand All @@ -31,8 +33,6 @@ export interface ActionInterface {
repositoryName?: string;
/** The fully qualified repositpory path, this gets auto generated if repositoryName is provided. */
repositoryPath?: string;
/** The root directory where your project lives. */
root?: string;
/** Wipes the commit history from the deployment branch in favor of a single commit. */
singleCommit?: boolean | null;
/** Determines if the action should run in silent mode or not. */
Expand All @@ -46,7 +46,28 @@ export interface ActionInterface {
/** The folder where your deployment project lives. */
workspace: string;
}
/** The minimum required values to run the action as a node module. */
export interface NodeActionInterface {
/** Deployment access token. */
accessToken?: string | null;
/** The branch that the action should deploy to. */
branch: string;
/** The folder to deploy. */
folder: string;
/** GitHub deployment token. */
gitHubToken?: string | null;
/** The repository path, for example JamesIves/github-pages-deploy-action. */
repositoryName: string;
/** Determines if the action should run in silent mode or not. */
silent: boolean;
/** Set to true if you're using an ssh client in your build step. */
ssh?: boolean | null;
/** The folder where your deployment project lives. */
workspace: string;
}
export declare const action: ActionInterface;
/** Types for the required action parameters. */
export declare type RequiredActionParameters = Pick<ActionInterface, 'accessToken' | 'gitHubToken' | 'ssh' | 'branch' | 'folder'>;
/** Status codes for the action. */
export declare enum Status {
SUCCESS = "success",
Expand Down
1 change: 0 additions & 1 deletion lib/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ exports.action = {
: repository && repository.full_name
? repository.full_name
: process.env.GITHUB_REPOSITORY,
root: '.',
singleCommit: !util_1.isNullOrUndefined(core_1.getInput('SINGLE_COMMIT'))
? core_1.getInput('SINGLE_COMMIT').toLowerCase() === 'true'
: false,
Expand Down
15 changes: 5 additions & 10 deletions lib/git.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ const util_1 = require("./util");
function init(action) {
return __awaiter(this, void 0, void 0, function* () {
try {
util_1.hasRequiredParameters(action);
core_1.info(`Deploying using ${action.tokenType}… 🔑`);
core_1.info('Configuring git…');
yield execute_1.execute(`git init`, action.workspace, action.silent);
Expand Down Expand Up @@ -56,7 +55,6 @@ exports.init = init;
function switchToBaseBranch(action) {
return __awaiter(this, void 0, void 0, function* () {
try {
util_1.hasRequiredParameters(action);
yield execute_1.execute(`git checkout --progress --force ${action.baseBranch ? action.baseBranch : action.defaultBranch}`, action.workspace, action.silent);
}
catch (error) {
Expand All @@ -69,7 +67,6 @@ exports.switchToBaseBranch = switchToBaseBranch;
function generateBranch(action) {
return __awaiter(this, void 0, void 0, function* () {
try {
util_1.hasRequiredParameters(action);
core_1.info(`Creating the ${action.branch} branch…`);
yield switchToBaseBranch(action);
yield execute_1.execute(`git checkout --orphan ${action.branch}`, action.workspace, action.silent);
Expand All @@ -94,7 +91,6 @@ function deploy(action) {
.substr(2, 9)}`;
core_1.info('Starting to commit changes…');
try {
util_1.hasRequiredParameters(action);
const commitMessage = !util_1.isNullOrUndefined(action.commitMessage)
? action.commitMessage
: `Deploying to ${action.branch} from ${action.baseBranch} ${process.env.GITHUB_SHA ? `@ ${process.env.GITHUB_SHA}` : ''} 🚀`;
Expand All @@ -118,9 +114,6 @@ function deploy(action) {
core_1.info(`Applying stashed workspace changes… ⬆️`);
try {
yield execute_1.execute(`git stash apply`, action.workspace, action.silent);
if (action.isTest) {
throw new Error();
}
}
catch (_a) {
core_1.info('Unable to apply from stash, continuing…');
Expand Down Expand Up @@ -150,13 +143,15 @@ function deploy(action) {
Pushes all of the build files into the deployment directory.
Allows the user to specify the root if '.' is provided.
rsync is used to prevent file duplication. */
yield execute_1.execute(`rsync -q -av --checksum --progress ${action.folder}/. ${action.targetFolder
yield execute_1.execute(`rsync -q -av --checksum --progress ${action.folderPath}/. ${action.targetFolder
? `${temporaryDeploymentDirectory}/${action.targetFolder}`
: temporaryDeploymentDirectory} ${action.clean
? `--delete ${excludes} ${!fs_1.default.existsSync(`${action.folder}/CNAME`) ? '--exclude CNAME' : ''} ${!fs_1.default.existsSync(`${action.folder}/.nojekyll`)
? `--delete ${excludes} ${!fs_1.default.existsSync(`${action.folderPath}/CNAME`)
? '--exclude CNAME'
: ''} ${!fs_1.default.existsSync(`${action.folderPath}/.nojekyll`)
? '--exclude .nojekyll'
: ''}`
: ''} --exclude .ssh --exclude .git --exclude .github ${action.folder === action.root
: ''} --exclude .ssh --exclude .git --exclude .github ${action.folderPath === action.workspace
? `--exclude ${temporaryDeploymentDirectory}`
: ''}`, action.workspace, action.silent);
const hasFilesToCommit = yield execute_1.execute(`git status --porcelain`, `${action.workspace}/${temporaryDeploymentDirectory}`, action.silent);
Expand Down
6 changes: 2 additions & 4 deletions lib/lib.d.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import { ActionInterface } from './constants';
import { deploy, generateBranch, init } from './git';
import { ActionInterface, NodeActionInterface } from './constants';
/** Initializes and runs the action.
*
* @param {object} configuration - The action configuration.
*/
export default function run(configuration: ActionInterface): Promise<void>;
export { init, deploy, generateBranch, ActionInterface };
export default function run(configuration: ActionInterface | NodeActionInterface): Promise<void>;
19 changes: 9 additions & 10 deletions lib/lib.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
});
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.generateBranch = exports.deploy = exports.init = void 0;
const core_1 = require("@actions/core");
const constants_1 = require("./constants");
const git_1 = require("./git");
Object.defineProperty(exports, "deploy", { enumerable: true, get: function () { return git_1.deploy; } });
Object.defineProperty(exports, "generateBranch", { enumerable: true, get: function () { return git_1.generateBranch; } });
Object.defineProperty(exports, "init", { enumerable: true, get: function () { return git_1.init; } });
const util_1 = require("./util");
/** Initializes and runs the action.
*
Expand All @@ -29,14 +25,17 @@ function run(configuration) {
GitHub Pages Deploy Action 🚀
🚀 Getting Started Guide: https://github.com/marketplace/actions/deploy-to-github-pages
❓ FAQ/Wiki: https://github.com/JamesIves/github-pages-deploy-action/wiki
🔧 Support: https://github.com/JamesIves/github-pages-deploy-action/issues
⭐ Contribute: https://github.com/JamesIves/github-pages-deploy-action/blob/dev/CONTRIBUTING.md
❓ Discussions / Q&A: https://github.com/JamesIves/github-pages-deploy-action/discussions
🔧 Report a Bug: https://github.com/JamesIves/github-pages-deploy-action/issues
📣 Maintained by James Ives (https://jamesiv.es)`);
📣 Maintained by James Ives: https://jamesiv.es
💖 Support: https://github.com/sponsors/JamesIves`);
core_1.info('Checking configuration and starting deployment… 🚦');
const settings = Object.assign(Object.assign({}, constants_1.action), configuration);
// Defines the repository paths and token types.
const settings = Object.assign({}, configuration);
// Defines the repository/folder paths and token types.
// Also verifies that the action has all of the required parameters.
settings.folderPath = util_1.generateFolderPath(settings);
util_1.checkParameters(settings);
settings.repositoryPath = util_1.generateRepositoryPath(settings);
settings.tokenType = util_1.generateTokenType(settings);
yield git_1.init(settings);
Expand Down
3 changes: 2 additions & 1 deletion lib/util.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@ import { ActionInterface } from './constants';
export declare const isNullOrUndefined: (value: any) => boolean;
export declare const generateTokenType: (action: ActionInterface) => string;
export declare const generateRepositoryPath: (action: ActionInterface) => string;
export declare const hasRequiredParameters: (action: ActionInterface) => void;
export declare const generateFolderPath: (action: ActionInterface) => string;
export declare const checkParameters: (action: ActionInterface) => void;
export declare const suppressSensitiveInformation: (str: string, action: ActionInterface) => string;
38 changes: 27 additions & 11 deletions lib/util.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.suppressSensitiveInformation = exports.hasRequiredParameters = exports.generateRepositoryPath = exports.generateTokenType = exports.isNullOrUndefined = void 0;
exports.suppressSensitiveInformation = exports.checkParameters = exports.generateFolderPath = exports.generateRepositoryPath = exports.generateTokenType = exports.isNullOrUndefined = void 0;
const fs_1 = require("fs");
const path_1 = __importDefault(require("path"));
const core_1 = require("@actions/core");
/* 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. */
exports.isNullOrUndefined = (value) => typeof value === 'undefined' || value === null || value === '';
Expand All @@ -17,23 +23,33 @@ exports.generateTokenType = (action) => action.ssh
exports.generateRepositoryPath = (action) => action.ssh
? `[email protected]:${action.repositoryName}`
: `https://${action.accessToken || `x-access-token:${action.gitHubToken}`}@github.com/${action.repositoryName}.git`;
/* Genetate absolute folder path by the provided folder name */
exports.generateFolderPath = (action) => {
const folderName = action['folder'];
return path_1.default.isAbsolute(folderName)
? folderName
: folderName.startsWith('~')
? folderName.replace('~', process.env.HOME)
: path_1.default.join(action.workspace, folderName);
};
/* Checks for the required tokens and formatting. Throws an error if any case is matched. */
exports.hasRequiredParameters = (action) => {
if ((exports.isNullOrUndefined(action.accessToken) &&
exports.isNullOrUndefined(action.gitHubToken) &&
exports.isNullOrUndefined(action.ssh)) ||
exports.isNullOrUndefined(action.repositoryPath) ||
(action.accessToken && action.accessToken === '')) {
const hasRequiredParameters = (action, params) => {
const nonNullParams = params.filter(param => !exports.isNullOrUndefined(action[param]));
return Boolean(nonNullParams.length);
};
/* Verifies the action has the required parameters to run, otherwise throw an error. */
exports.checkParameters = (action) => {
if (!hasRequiredParameters(action, ['accessToken', 'gitHubToken', 'ssh'])) {
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. If you wish to use an ssh deploy token then you must set SSH to true.');
}
if (exports.isNullOrUndefined(action.branch)) {
if (!hasRequiredParameters(action, ['branch'])) {
throw new Error('Branch is required.');
}
if (!action.folder || exports.isNullOrUndefined(action.folder)) {
if (!hasRequiredParameters(action, ['folder'])) {
throw new Error('You must provide the action with a folder to deploy.');
}
if (action.folder.startsWith('/') || action.folder.startsWith('./')) {
throw new Error("Incorrectly formatted build folder. The deployment folder cannot be prefixed with '/' or './'. Instead reference the folder name directly.");
if (!fs_1.existsSync(action.folderPath)) {
throw new Error(`The directory you're trying to deploy named ${action.folderPath} doesn't exist. Please double check the path and any prerequisite build scripts and try again. ❗`);
}
};
/* Suppresses sensitive information from being exposed in error messages. */
Expand Down
1 change: 0 additions & 1 deletion node_modules/.bin/eslint-github-init

This file was deleted.

1 change: 0 additions & 1 deletion node_modules/.bin/eslint-unused-modules

This file was deleted.

1 change: 0 additions & 1 deletion node_modules/.bin/flow-coverage

This file was deleted.

1 change: 0 additions & 1 deletion node_modules/.bin/github-lint

This file was deleted.

1 change: 0 additions & 1 deletion node_modules/.bin/jsdoctypeparser

This file was deleted.

1 change: 0 additions & 1 deletion node_modules/.bin/loose-envify

This file was deleted.

1 change: 0 additions & 1 deletion node_modules/.bin/npm-check-github-package-requirements

This file was deleted.

2 changes: 1 addition & 1 deletion node_modules/.bin/rimraf

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

2 changes: 1 addition & 1 deletion node_modules/@babel/core/node_modules/.bin/semver

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

22 changes: 0 additions & 22 deletions node_modules/@babel/runtime-corejs3/LICENSE

This file was deleted.

17 changes: 0 additions & 17 deletions node_modules/@babel/runtime-corejs3/README.md

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Loading

0 comments on commit 132898c

Please sign in to comment.