3.7.0 🚀

This commit is contained in:
James Ives 2020-10-17 15:22:15 -04:00
parent e45a9df141
commit 132898c54c
9697 changed files with 50908 additions and 362821 deletions

25
lib/constants.d.ts vendored
View File

@ -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. */
@ -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. */
@ -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",

View File

@ -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,

View File

@ -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);
@ -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) {
@ -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);
@ -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}` : ''} 🚀`;
@ -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…');
@ -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);

6
lib/lib.d.ts vendored
View File

@ -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>;

View File

@ -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.
*
@ -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);

3
lib/util.d.ts vendored
View File

@ -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;

View File

@ -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 === '';
@ -17,23 +23,33 @@ exports.generateTokenType = (action) => action.ssh
exports.generateRepositoryPath = (action) => action.ssh
? `git@github.com:${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. */

View File

@ -1 +0,0 @@
../eslint-plugin-github/bin/eslint-github-init.js

View File

@ -1 +0,0 @@
../eslint-plugin-github/bin/eslint-unused-modules.js

1
node_modules/.bin/flow-coverage generated vendored
View File

@ -1 +0,0 @@
../eslint-plugin-github/bin/flow-coverage.js

1
node_modules/.bin/github-lint generated vendored
View File

@ -1 +0,0 @@
../eslint-plugin-github/bin/github-lint.js

1
node_modules/.bin/jsdoctypeparser generated vendored
View File

@ -1 +0,0 @@
../jsdoctypeparser/bin/jsdoctypeparser

1
node_modules/.bin/loose-envify generated vendored
View File

@ -1 +0,0 @@
../loose-envify/cli.js

View File

@ -1 +0,0 @@
../eslint-plugin-github/bin/npm-check-github-package-requirements.js

2
node_modules/.bin/rimraf generated vendored
View File

@ -1 +1 @@
../flat-cache/node_modules/rimraf/bin.js
../rimraf/bin.js

View File

@ -1 +1 @@
../semver/bin/semver
../../../../normalize-package-data/node_modules/semver/bin/semver

View File

@ -1,22 +0,0 @@
MIT License
Copyright (c) 2014-present Sebastian McKenzie and other contributors
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

View File

@ -1,17 +0,0 @@
# @babel/runtime-corejs3
> babel's modular runtime helpers with core-js@3 polyfilling
## Install
Using npm:
```sh
npm install --save-dev @babel/runtime-corejs3
```
or using yarn:
```sh
yarn add @babel/runtime-corejs3 --dev
```

View File

@ -1 +0,0 @@
module.exports = require("core-js-pure/stable/array/from");

View File

@ -1 +0,0 @@
module.exports = require("core-js-pure/stable/array/is-array");

View File

@ -1 +0,0 @@
module.exports = require("core-js-pure/stable/array/of");

View File

@ -1 +0,0 @@
module.exports = require("core-js-pure/stable/clear-immediate");

View File

@ -1 +0,0 @@
module.exports = require("core-js-pure/stable/date/now");

View File

@ -1 +0,0 @@
module.exports = require("core-js-pure/stable/instance/bind");

View File

@ -1 +0,0 @@
module.exports = require("core-js-pure/stable/instance/code-point-at");

View File

@ -1 +0,0 @@
module.exports = require("core-js-pure/stable/instance/concat");

View File

@ -1 +0,0 @@
module.exports = require("core-js-pure/stable/instance/copy-within");

View File

@ -1 +0,0 @@
module.exports = require("core-js-pure/stable/instance/ends-with");

View File

@ -1 +0,0 @@
module.exports = require("core-js-pure/stable/instance/entries");

View File

@ -1 +0,0 @@
module.exports = require("core-js-pure/stable/instance/every");

View File

@ -1 +0,0 @@
module.exports = require("core-js-pure/stable/instance/fill");

View File

@ -1 +0,0 @@
module.exports = require("core-js-pure/stable/instance/filter");

View File

@ -1 +0,0 @@
module.exports = require("core-js-pure/stable/instance/find-index");

View File

@ -1 +0,0 @@
module.exports = require("core-js-pure/stable/instance/find");

View File

@ -1 +0,0 @@
module.exports = require("core-js-pure/stable/instance/flags");

View File

@ -1 +0,0 @@
module.exports = require("core-js-pure/stable/instance/flat-map");

View File

@ -1 +0,0 @@
module.exports = require("core-js-pure/stable/instance/flat");

View File

@ -1 +0,0 @@
module.exports = require("core-js-pure/stable/instance/for-each");

View File

@ -1 +0,0 @@
module.exports = require("core-js-pure/stable/instance/includes");

View File

@ -1 +0,0 @@
module.exports = require("core-js-pure/stable/instance/index-of");

View File

@ -1 +0,0 @@
module.exports = require("core-js-pure/stable/instance/keys");

View File

@ -1 +0,0 @@
module.exports = require("core-js-pure/stable/instance/last-index-of");

View File

@ -1 +0,0 @@
module.exports = require("core-js-pure/stable/instance/map");

View File

@ -1 +0,0 @@
module.exports = require("core-js-pure/stable/instance/pad-end");

View File

@ -1 +0,0 @@
module.exports = require("core-js-pure/stable/instance/pad-start");

View File

@ -1 +0,0 @@
module.exports = require("core-js-pure/stable/instance/reduce-right");

View File

@ -1 +0,0 @@
module.exports = require("core-js-pure/stable/instance/reduce");

View File

@ -1 +0,0 @@
module.exports = require("core-js-pure/stable/instance/repeat");

View File

@ -1 +0,0 @@
module.exports = require("core-js-pure/stable/instance/reverse");

View File

@ -1 +0,0 @@
module.exports = require("core-js-pure/stable/instance/slice");

View File

@ -1 +0,0 @@
module.exports = require("core-js-pure/stable/instance/some");

View File

@ -1 +0,0 @@
module.exports = require("core-js-pure/stable/instance/sort");

View File

@ -1 +0,0 @@
module.exports = require("core-js-pure/stable/instance/splice");

View File

@ -1 +0,0 @@
module.exports = require("core-js-pure/stable/instance/starts-with");

View File

@ -1 +0,0 @@
module.exports = require("core-js-pure/stable/instance/trim-end");

View File

@ -1 +0,0 @@
module.exports = require("core-js-pure/stable/instance/trim-left");

View File

@ -1 +0,0 @@
module.exports = require("core-js-pure/stable/instance/trim-right");

View File

@ -1 +0,0 @@
module.exports = require("core-js-pure/stable/instance/trim-start");

View File

@ -1 +0,0 @@
module.exports = require("core-js-pure/stable/instance/trim");

View File

@ -1 +0,0 @@
module.exports = require("core-js-pure/stable/instance/values");

View File

@ -1 +0,0 @@
module.exports = require("core-js-pure/stable/json/stringify");

View File

@ -1 +0,0 @@
module.exports = require("core-js-pure/stable/map");

View File

@ -1 +0,0 @@
module.exports = require("core-js-pure/stable/math/acosh");

View File

@ -1 +0,0 @@
module.exports = require("core-js-pure/stable/math/asinh");

View File

@ -1 +0,0 @@
module.exports = require("core-js-pure/stable/math/atanh");

View File

@ -1 +0,0 @@
module.exports = require("core-js-pure/stable/math/cbrt");

View File

@ -1 +0,0 @@
module.exports = require("core-js-pure/stable/math/clz32");

View File

@ -1 +0,0 @@
module.exports = require("core-js-pure/stable/math/cosh");

View File

@ -1 +0,0 @@
module.exports = require("core-js-pure/stable/math/expm1");

View File

@ -1 +0,0 @@
module.exports = require("core-js-pure/stable/math/fround");

View File

@ -1 +0,0 @@
module.exports = require("core-js-pure/stable/math/hypot");

View File

@ -1 +0,0 @@
module.exports = require("core-js-pure/stable/math/imul");

View File

@ -1 +0,0 @@
module.exports = require("core-js-pure/stable/math/log10");

View File

@ -1 +0,0 @@
module.exports = require("core-js-pure/stable/math/log1p");

View File

@ -1 +0,0 @@
module.exports = require("core-js-pure/stable/math/log2");

View File

@ -1 +0,0 @@
module.exports = require("core-js-pure/stable/math/sign");

View File

@ -1 +0,0 @@
module.exports = require("core-js-pure/stable/math/sinh");

View File

@ -1 +0,0 @@
module.exports = require("core-js-pure/stable/math/tanh");

View File

@ -1 +0,0 @@
module.exports = require("core-js-pure/stable/math/trunc");

View File

@ -1 +0,0 @@
module.exports = require("core-js-pure/stable/number/epsilon");

View File

@ -1 +0,0 @@
module.exports = require("core-js-pure/stable/number/is-finite");

View File

@ -1 +0,0 @@
module.exports = require("core-js-pure/stable/number/is-integer");

View File

@ -1 +0,0 @@
module.exports = require("core-js-pure/stable/number/is-nan");

View File

@ -1 +0,0 @@
module.exports = require("core-js-pure/stable/number/is-safe-integer");

View File

@ -1 +0,0 @@
module.exports = require("core-js-pure/stable/number/max-safe-integer");

View File

@ -1 +0,0 @@
module.exports = require("core-js-pure/stable/number/min-safe-integer");

View File

@ -1 +0,0 @@
module.exports = require("core-js-pure/stable/number/parse-float");

View File

@ -1 +0,0 @@
module.exports = require("core-js-pure/stable/number/parse-int");

View File

@ -1 +0,0 @@
module.exports = require("core-js-pure/stable/object/assign");

View File

@ -1 +0,0 @@
module.exports = require("core-js-pure/stable/object/create");

View File

@ -1 +0,0 @@
module.exports = require("core-js-pure/stable/object/define-properties");

View File

@ -1 +0,0 @@
module.exports = require("core-js-pure/stable/object/define-property");

View File

@ -1 +0,0 @@
module.exports = require("core-js-pure/stable/object/entries");

View File

@ -1 +0,0 @@
module.exports = require("core-js-pure/stable/object/freeze");

View File

@ -1 +0,0 @@
module.exports = require("core-js-pure/stable/object/from-entries");

View File

@ -1 +0,0 @@
module.exports = require("core-js-pure/stable/object/get-own-property-descriptor");

View File

@ -1 +0,0 @@
module.exports = require("core-js-pure/stable/object/get-own-property-descriptors");

View File

@ -1 +0,0 @@
module.exports = require("core-js-pure/stable/object/get-own-property-names");

View File

@ -1 +0,0 @@
module.exports = require("core-js-pure/stable/object/get-own-property-symbols");

View File

@ -1 +0,0 @@
module.exports = require("core-js-pure/stable/object/get-prototype-of");

Some files were not shown because too many files have changed in this diff Show More