github-pages-deploy-action
Advanced tools
Comparing version 3.4.1 to 3.4.2
@@ -1,1 +0,1 @@ | ||
process.env.UNIT_TEST = "true" | ||
process.env.UNIT_TEST = 'true' |
@@ -38,3 +38,2 @@ { | ||
"@typescript-eslint/no-non-null-assertion": "warn", | ||
"@typescript-eslint/no-object-literal-type-assertion": "error", | ||
"@typescript-eslint/no-unnecessary-qualifier": "error", | ||
@@ -47,3 +46,2 @@ "@typescript-eslint/no-unnecessary-type-assertion": "error", | ||
"@typescript-eslint/prefer-includes": "error", | ||
"@typescript-eslint/prefer-interface": "error", | ||
"@typescript-eslint/prefer-string-starts-ends-with": "error", | ||
@@ -50,0 +48,0 @@ "@typescript-eslint/promise-function-async": "error", |
@@ -11,5 +11,5 @@ module.exports = { | ||
verbose: true, | ||
setupFiles: ["<rootDir>/__tests__/env.js"], | ||
setupFiles: ['<rootDir>/__tests__/env.js'], | ||
collectCoverage: true, | ||
collectCoverageFrom: ['src/*.ts','!src/constants.ts'] | ||
} | ||
collectCoverageFrom: ['src/*.ts', '!src/constants.ts'] | ||
} |
@@ -28,3 +28,3 @@ export interface ActionInterface { | ||
name?: string; | ||
/** The repository path, for example JamesIves/github-pages-deploy-action */ | ||
/** The repository path, for example JamesIves/github-pages-deploy-action. */ | ||
repositoryName?: string; | ||
@@ -31,0 +31,0 @@ /** The fully qualified repositpory path, this gets auto generated if repositoryName is provided. */ |
/** Wrapper around the GitHub toolkit exec command which returns the output. | ||
* Also allows you to easily toggle the current working directory. | ||
* @param cmd = The command to execute. | ||
* @param cwd - The current working directory. | ||
* @returns - The output from the command. | ||
* | ||
* @param {string} cmd - The command to execute. | ||
* @param {string} cwd - The current working directory. | ||
*/ | ||
export declare function execute(cmd: string, cwd: string): Promise<any>; | ||
export declare function stdout(data: any): string | void; |
@@ -16,5 +16,5 @@ "use strict"; | ||
* Also allows you to easily toggle the current working directory. | ||
* @param cmd = The command to execute. | ||
* @param cwd - The current working directory. | ||
* @returns - The output from the command. | ||
* | ||
* @param {string} cmd - The command to execute. | ||
* @param {string} cwd - The current working directory. | ||
*/ | ||
@@ -21,0 +21,0 @@ function execute(cmd, cwd) { |
@@ -19,4 +19,4 @@ "use strict"; | ||
util_1.hasRequiredParameters(action); | ||
console.log(`Deploying using ${action.tokenType}... ๐`); | ||
console.log('Configuring git...'); | ||
console.log(`Deploying using ${action.tokenType}โฆ ๐`); | ||
console.log('Configuring Gitโฆ'); | ||
yield execute_1.execute(`git init`, action.workspace); | ||
@@ -28,3 +28,3 @@ yield execute_1.execute(`git config user.name "${action.name}"`, action.workspace); | ||
yield execute_1.execute(`git fetch`, action.workspace); | ||
console.log('Git configured... ๐ง'); | ||
console.log('Git configuredโฆ ๐ง'); | ||
} | ||
@@ -55,10 +55,10 @@ catch (error) { | ||
util_1.hasRequiredParameters(action); | ||
console.log(`Creating the ${action.branch} branch...`); | ||
console.log(`Creating the ${action.branch} branchโฆ`); | ||
yield switchToBaseBranch(action); | ||
yield execute_1.execute(`git checkout --orphan ${action.branch}`, action.workspace); | ||
yield execute_1.execute(`git reset --hard`, action.workspace); | ||
yield execute_1.execute(`git commit --allow-empty -m "Initial ${action.branch} commit."`, action.workspace); | ||
yield execute_1.execute(`git commit --allow-empty -m "Initial ${action.branch} commit"`, action.workspace); | ||
yield execute_1.execute(`git push ${action.repositoryPath} ${action.branch}`, action.workspace); | ||
yield execute_1.execute(`git fetch`, action.workspace); | ||
console.log(`Created the ${action.branch} branch... ๐ง`); | ||
console.log(`Created the ${action.branch} branchโฆ ๐ง`); | ||
} | ||
@@ -76,3 +76,3 @@ catch (error) { | ||
const temporaryDeploymentBranch = 'gh-action-temp-deployment-branch'; | ||
console.log('Starting to commit changes...'); | ||
console.log('Starting to commit changesโฆ'); | ||
try { | ||
@@ -120,3 +120,3 @@ util_1.hasRequiredParameters(action); | ||
if (!hasFilesToCommit && !action.isTest) { | ||
console.log('There is nothing to commit. Exiting early... ๐ญ'); | ||
console.log('There is nothing to commit. Exiting earlyโฆ ๐ญ'); | ||
return; | ||
@@ -129,7 +129,7 @@ } | ||
? action.commitMessage | ||
: `Deploying to ${action.branch} from ${action.baseBranch}`} ${process.env.GITHUB_SHA ? `- ${process.env.GITHUB_SHA}` : ''} ๐" --quiet`, `${action.workspace}/${temporaryDeploymentDirectory}`); | ||
: `Deploying to ${action.branch} from ${action.baseBranch}`} ${process.env.GITHUB_SHA ? `@ ${process.env.GITHUB_SHA}` : ''} ๐" --quiet`, `${action.workspace}/${temporaryDeploymentDirectory}`); | ||
yield execute_1.execute(`git push --force ${action.repositoryPath} ${temporaryDeploymentBranch}:${action.branch}`, `${action.workspace}/${temporaryDeploymentDirectory}`); | ||
console.log(`Changes committed to the ${action.branch} branch... ๐ฆ`); | ||
console.log(`Changes committed to the ${action.branch} branchโฆ ๐ฆ`); | ||
// Cleans up temporary files/folders and restores the git state. | ||
console.log('Running post deployment cleanup jobs...'); | ||
console.log('Running post deployment cleanup jobsโฆ'); | ||
yield execute_1.execute(`git checkout --progress --force ${action.defaultBranch}`, action.workspace); | ||
@@ -136,0 +136,0 @@ } |
import { ActionInterface } from './constants'; | ||
import { deploy, generateBranch, init } from './git'; | ||
/** Initializes and runs the action. */ | ||
/** Initializes and runs the action. | ||
* | ||
* @param {object} configuration - The action configuration. | ||
*/ | ||
export default function run(configuration: ActionInterface): Promise<void>; | ||
export { init, deploy, generateBranch, ActionInterface }; |
@@ -19,3 +19,6 @@ "use strict"; | ||
const util_1 = require("./util"); | ||
/** Initializes and runs the action. */ | ||
/** Initializes and runs the action. | ||
* | ||
* @param {object} configuration - The action configuration. | ||
*/ | ||
function run(configuration) { | ||
@@ -25,3 +28,3 @@ return __awaiter(this, void 0, void 0, function* () { | ||
try { | ||
console.log('Checking configuration and starting deployment...๐ฆ'); | ||
console.log('Checking configuration and starting deploymentโฆ ๐ฆ'); | ||
const settings = Object.assign(Object.assign({}, constants_1.action), configuration); | ||
@@ -28,0 +31,0 @@ // Defines the repository paths and token types. |
@@ -5,3 +5,3 @@ { | ||
"author": "James Ives <iam@jamesiv.es>", | ||
"version": "3.4.1", | ||
"version": "3.4.2", | ||
"license": "MIT", | ||
@@ -48,7 +48,7 @@ "main": "lib/lib.js", | ||
"ts-jest": "^25.0.0", | ||
"eslint": "^5.16.0", | ||
"eslint-plugin-github": "^2.0.0", | ||
"eslint-plugin-jest": "^22.21.0", | ||
"eslint": "^6.8.0", | ||
"eslint-plugin-github": "^3.4.1", | ||
"eslint-plugin-jest": "^23.8.2", | ||
"typescript": "^3.7.4" | ||
} | ||
} |
@@ -1,9 +0,41 @@ | ||
# GitHub Pages Deploy Action :rocket: | ||
<p align="center"> | ||
<a href="https://github.com/marketplace/actions/deploy-to-github-pages"> | ||
<img width="150px" src="./assets/icon.png"> | ||
</a> | ||
</p> | ||
[![Build Status](https://github.com/JamesIves/github-pages-deploy-action/workflows/unit-tests/badge.svg)](https://github.com/JamesIves/github-pages-deploy-action/actions) [![Actions Status](https://github.com/JamesIves/github-pages-deploy-action/workflows/integration-tests/badge.svg)](https://github.com/JamesIves/github-pages-deploy-action/actions) [![View Action](https://img.shields.io/badge/action-marketplace-blue.svg?logo=github&color=orange)](https://github.com/marketplace/actions/deploy-to-github-pages) [![Version](https://img.shields.io/github/v/release/JamesIves/github-pages-deploy-action.svg?logo=github)](https://github.com/JamesIves/github-pages-deploy-action/releases) [![Codecov Coverage](https://codecov.io/gh/JamesIves/github-pages-deploy-action/branch/dev/graph/badge.svg)](https://codecov.io/gh/JamesIves/github-pages-deploy-action/branch/dev) | ||
<h1 align="center"> | ||
GitHub Pages Deploy Action :rocket: | ||
</h1> | ||
This [GitHub action](https://github.com/features/actions) will handle the deploy process of your project to [GitHub Pages](https://pages.github.com/). It can be configured to upload your production-ready code into any branch you'd like, including `gh-pages` and `docs`. | ||
<p align="center"> | ||
<a href="https://github.com/JamesIves/github-pages-deploy-action/actions"> | ||
<img src="https://github.com/JamesIves/github-pages-deploy-action/workflows/unit-tests/badge.svg"> | ||
</a> | ||
<a href="https://github.com/JamesIves/github-pages-deploy-action/actions"> | ||
<img src="https://github.com/JamesIves/github-pages-deploy-action/workflows/integration-tests/badge.svg"> | ||
</a> | ||
<a href="https://github.com/marketplace/actions/deploy-to-github-pages"> | ||
<img src="https://img.shields.io/badge/action-marketplace-blue.svg?logo=github&color=orange"> | ||
</a> | ||
<a href="https://github.com/JamesIves/github-pages-deploy-action/releases"> | ||
<img src="https://img.shields.io/github/v/release/JamesIves/github-pages-deploy-action.svg?logo=github"> | ||
</a> | ||
<a href="https://codecov.io/gh/JamesIves/github-pages-deploy-action/branch/dev"> | ||
<img src="https://codecov.io/gh/JamesIves/github-pages-deploy-action/branch/dev/graph/badge.svg"> | ||
</a> | ||
</p> | ||
![Example Screenshot](screenshot.png) | ||
<p align="center"> | ||
This <a href="https://github.com/features/actions">GitHub Action</a> will deploy your project to <a href="https://pages.github.com/">GitHub Pages</a>. It can be configured to upload your production-ready code into any branch you'd like, including <b>gh-pages</b> and <b>docs</b>. | ||
</p> | ||
<p align="center"> | ||
<img src="./assets/screenshot.png"> | ||
</p> | ||
## Getting Started :airplane: | ||
@@ -27,3 +59,8 @@ | ||
- name: Build and Deploy ๐ | ||
- name: Install and Build ๐ง # This example project is built using npm and outputs the result to the 'build' folder. Replace with the commands required to build your project, or remove this step entirely if your site is pre-built. | ||
run: | | ||
npm install | ||
npm run build | ||
- name: Deploy ๐ | ||
uses: JamesIves/github-pages-deploy-action@releases/v3 | ||
@@ -133,3 +170,3 @@ with: | ||
```yml | ||
- name: Install SSH Client | ||
- name: Install SSH Client ๐ | ||
uses: webfactory/ssh-agent@v0.2.0 | ||
@@ -139,3 +176,3 @@ with: | ||
- name: Build and Deploy ๐ | ||
- name: Deploy ๐ | ||
uses: JamesIves/github-pages-deploy-action@releases/v3 | ||
@@ -166,6 +203,6 @@ with: | ||
- name: Install | ||
- name: Install and Build ๐ง # This example project is built using npm and outputs the result to the 'build' folder. Replace with the commands required to build your project, or remove this step entirely if your site is pre-built. | ||
run: | | ||
npm install | ||
npm run-script build | ||
npm run build | ||
@@ -177,3 +214,3 @@ - name: Install SSH Client ๐ | ||
- name: Build and Deploy Repo ๐ | ||
- name: Deploy ๐ | ||
uses: JamesIves/github-pages-deploy-action@releases/v3-test | ||
@@ -220,8 +257,8 @@ with: | ||
- name: Install # The project is built using npm and placed in the 'build' folder. | ||
- name: Install and Build ๐ง # This example project is built using npm and outputs the result to the 'build' folder. Replace with the commands required to build your project, or remove this step entirely if your site is pre-built. | ||
run: | | ||
npm install | ||
npm run-script build | ||
npm run build | ||
- name: Upload Artifacts # The project is then uploaded as an artifact named 'site'. | ||
- name: Upload Artifacts ๐บ # The project is then uploaded as an artifact named 'site'. | ||
uses: actions/upload-artifact@v1 | ||
@@ -241,3 +278,3 @@ with: | ||
- name: Download Artifacts # The built project is downloaded into the 'site' folder. | ||
- name: Download Artifacts ๐ป # The built project is downloaded into the 'site' folder. | ||
uses: actions/download-artifact@v1 | ||
@@ -247,3 +284,3 @@ with: | ||
- name: Build and Deploy ๐ | ||
- name: Deploy ๐ | ||
uses: JamesIves/github-pages-deploy-action@releases/v3 | ||
@@ -266,7 +303,7 @@ with: | ||
```yml | ||
- name: Install rsync | ||
- name: Install rsync ๐ | ||
run: | | ||
apt-get update && apt-get install -y rsync | ||
- name: Deploy | ||
- name: Deploy ๐ | ||
uses: JamesIves/github-pages-deploy-action@releases/v3 | ||
@@ -273,0 +310,0 @@ ``` |
@@ -35,3 +35,3 @@ import {getInput} from '@actions/core' | ||
name?: string | ||
/** The repository path, for example JamesIves/github-pages-deploy-action */ | ||
/** The repository path, for example JamesIves/github-pages-deploy-action. */ | ||
repositoryName?: string | ||
@@ -38,0 +38,0 @@ /** The fully qualified repositpory path, this gets auto generated if repositoryName is provided. */ |
@@ -7,5 +7,5 @@ import {exec} from '@actions/exec' | ||
* Also allows you to easily toggle the current working directory. | ||
* @param cmd = The command to execute. | ||
* @param cwd - The current working directory. | ||
* @returns - The output from the command. | ||
* | ||
* @param {string} cmd - The command to execute. | ||
* @param {string} cwd - The current working directory. | ||
*/ | ||
@@ -12,0 +12,0 @@ export async function execute(cmd: string, cwd: string): Promise<any> { |
@@ -14,4 +14,4 @@ import {ActionInterface} from './constants' | ||
console.log(`Deploying using ${action.tokenType}... ๐`) | ||
console.log('Configuring git...') | ||
console.log(`Deploying using ${action.tokenType}โฆ ๐`) | ||
console.log('Configuring Gitโฆ') | ||
@@ -28,3 +28,3 @@ await execute(`git init`, action.workspace) | ||
console.log('Git configured... ๐ง') | ||
console.log('Git configuredโฆ ๐ง') | ||
} catch (error) { | ||
@@ -68,3 +68,3 @@ throw new Error( | ||
console.log(`Creating the ${action.branch} branch...`) | ||
console.log(`Creating the ${action.branch} branchโฆ`) | ||
@@ -75,3 +75,3 @@ await switchToBaseBranch(action) | ||
await execute( | ||
`git commit --allow-empty -m "Initial ${action.branch} commit."`, | ||
`git commit --allow-empty -m "Initial ${action.branch} commit"`, | ||
action.workspace | ||
@@ -85,3 +85,3 @@ ) | ||
console.log(`Created the ${action.branch} branch... ๐ง`) | ||
console.log(`Created the ${action.branch} branchโฆ ๐ง`) | ||
} catch (error) { | ||
@@ -101,3 +101,3 @@ throw new Error( | ||
const temporaryDeploymentBranch = 'gh-action-temp-deployment-branch' | ||
console.log('Starting to commit changes...') | ||
console.log('Starting to commit changesโฆ') | ||
@@ -174,3 +174,3 @@ try { | ||
if (!hasFilesToCommit && !action.isTest) { | ||
console.log('There is nothing to commit. Exiting early... ๐ญ') | ||
console.log('There is nothing to commit. Exiting earlyโฆ ๐ญ') | ||
return | ||
@@ -194,3 +194,3 @@ } | ||
} ${ | ||
process.env.GITHUB_SHA ? `- ${process.env.GITHUB_SHA}` : '' | ||
process.env.GITHUB_SHA ? `@ ${process.env.GITHUB_SHA}` : '' | ||
} ๐" --quiet`, | ||
@@ -204,6 +204,6 @@ `${action.workspace}/${temporaryDeploymentDirectory}` | ||
console.log(`Changes committed to the ${action.branch} branch... ๐ฆ`) | ||
console.log(`Changes committed to the ${action.branch} branchโฆ ๐ฆ`) | ||
// Cleans up temporary files/folders and restores the git state. | ||
console.log('Running post deployment cleanup jobs...') | ||
console.log('Running post deployment cleanup jobsโฆ') | ||
await execute( | ||
@@ -210,0 +210,0 @@ `git checkout --progress --force ${action.defaultBranch}`, |
@@ -6,3 +6,6 @@ import {exportVariable, setFailed} from '@actions/core' | ||
/** Initializes and runs the action. */ | ||
/** Initializes and runs the action. | ||
* | ||
* @param {object} configuration - The action configuration. | ||
*/ | ||
export default async function run( | ||
@@ -14,3 +17,3 @@ configuration: ActionInterface | ||
try { | ||
console.log('Checking configuration and starting deployment...๐ฆ') | ||
console.log('Checking configuration and starting deploymentโฆ ๐ฆ') | ||
@@ -17,0 +20,0 @@ const settings = { |
Sorry, the diff of this file is not supported yet
1499757
49
1573
308