Merge branch 'dev' into releases/v3

This commit is contained in:
James Ives 2020-07-13 13:08:20 -04:00
commit 5eb7bd324f
6 changed files with 63 additions and 22 deletions

4
.gitignore vendored
View File

@ -7,6 +7,10 @@ yarn-debug.log*
yarn-error.log*
#node_modules
# Test Temp Files
assets/.nojekyll
assets/CNAME
# Build
# lib

View File

@ -52,7 +52,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout 🛎️
uses: actions/checkout@v2 # If you're using actions/checkout@v2 you must set persist-credentials to false in most cases for the deployment to work correctly.
uses: actions/checkout@v2.3.1 # If you're using actions/checkout@v2 you must set persist-credentials to false in most cases for the deployment to work correctly.
with:
persist-credentials: false
@ -62,7 +62,7 @@ jobs:
npm run build
- name: Deploy 🚀
uses: JamesIves/github-pages-deploy-action@releases/v3
uses: JamesIves/github-pages-deploy-action@3.5.7
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BRANCH: gh-pages # The branch the action should deploy to.
@ -78,6 +78,8 @@ on:
- master
```
It's recommended that you use [Dependabot](https://dependabot.com/github-actions/) to keep your workflow up-to-date. You can find the latest tagged version on the [GitHub Marketplace](https://github.com/marketplace/actions/deploy-to-github-pages) or on the [releases page](https://github.com/JamesIves/github-pages-deploy-action/releases).
#### Install as a Node Module 📦
If you'd like to use the functionality provided by this action in your own action you can install it using [yarn](https://yarnpkg.com/) by running the following command.
@ -315,7 +317,9 @@ If you use a [container](https://help.github.com/en/actions/automating-your-work
### Additional Build Files 📁
If you're using a custom domain and require a `CNAME` file, or if you require the use of a `.nojekyll` file, you can safely commit these files directly into deployment branch without them being overridden after each deployment.
If you're using a custom domain and require a `CNAME` file, or if you require the use of a `.nojekyll` file, you can safely commit these files directly into deployment branch without them being overridden after each deployment. Additionally you can include these files in your deployment folder to update them.
If you wish to remove these files you must go into the deployment branch directly to remove them. This is to prevent accidental changes in your deployment script from creating breaking changes.
---

View File

@ -6,6 +6,7 @@ import {mkdirP, rmRF} from '@actions/io'
import {action, Status} from '../src/constants'
import {execute} from '../src/execute'
import {deploy, generateBranch, init, switchToBaseBranch} from '../src/git'
import fs from 'fs';
const originalAction = JSON.stringify(action)
@ -362,6 +363,30 @@ describe('git', () => {
expect(response).toBe(Status.SUCCESS)
})
it('should not ignore CNAME or nojekyll if they exist in the deployment folder', async () => {
Object.assign(action, {
silent: false,
folder: 'assets',
branch: 'branch',
gitHubToken: '123',
pusher: {
name: 'asd',
email: 'as@cat'
},
clean: true,
})
const response = await deploy(action)
fs.createWriteStream("assets/.nojekyll");
fs.createWriteStream("assets/CNAME");
// Includes the call to generateBranch
expect(execute).toBeCalledTimes(12)
expect(rmRF).toBeCalledTimes(1)
expect(response).toBe(Status.SUCCESS)
})
it('should execute commands with single commit toggled', async () => {
Object.assign(action, {
silent: false,
@ -381,6 +406,7 @@ describe('git', () => {
expect(execute).toBeCalledTimes(18)
expect(rmRF).toBeCalledTimes(1)
})
it('should execute commands with clean options, ommits sha commit message', async () => {
process.env.GITHUB_SHA = ''

View File

@ -2,7 +2,7 @@
"name": "@jamesives/github-pages-deploy-action",
"description": "GitHub action for building a project and deploying it to GitHub pages.",
"author": "James Ives <iam@jamesiv.es> (https://jamesiv.es)",
"version": "3.5.6",
"version": "3.5.7",
"license": "MIT",
"main": "lib/lib.js",
"types": "lib/lib.d.ts",
@ -39,11 +39,11 @@
"@actions/io": "1.0.2"
},
"devDependencies": {
"@types/jest": "26.0.3",
"@types/node": "14.0.14",
"eslint": "7.3.1",
"@types/jest": "26.0.4",
"@types/node": "14.0.23",
"eslint": "7.4.0",
"eslint-plugin-github": "3.4.1",
"eslint-plugin-jest": "23.17.1",
"eslint-plugin-jest": "23.18.0",
"eslint-plugin-prettier": "^3.1.2",
"jest": "25.5.4",
"jest-circus": "26.1.0",

View File

@ -1,5 +1,6 @@
import {info} from '@actions/core'
import {rmRF, mkdirP} from '@actions/io'
import {mkdirP, rmRF} from '@actions/io'
import fs from 'fs'
import {ActionInterface, Status} from './constants'
import {execute} from './execute'
import {
@ -193,7 +194,13 @@ export async function deploy(action: ActionInterface): Promise<Status> {
: temporaryDeploymentDirectory
} ${
action.clean
? `--delete ${excludes} --exclude CNAME --exclude .nojekyll`
? `--delete ${excludes} ${
!fs.existsSync(`${action.folder}/CNAME`) ? '--exclude CNAME' : ''
} ${
!fs.existsSync(`${action.folder}/.nojekyll`)
? '--exclude .nojekyll'
: ''
}`
: ''
} --exclude .ssh --exclude .git --exclude .github ${
action.folder === action.root

View File

@ -767,9 +767,9 @@
"@types/istanbul-lib-coverage" "*"
"@types/istanbul-lib-report" "*"
"@types/jest@26.0.3":
version "26.0.3"
resolved "https://registry.yarnpkg.com/@types/jest/-/jest-26.0.3.tgz#79534e0e94857171c0edc596db0ebe7cb7863251"
"@types/jest@26.0.4":
version "26.0.4"
resolved "https://registry.yarnpkg.com/@types/jest/-/jest-26.0.4.tgz#d2e513e85aca16992816f192582b5e67b0b15efb"
dependencies:
jest-diff "^25.2.1"
pretty-format "^25.2.1"
@ -778,9 +778,9 @@
version "7.0.4"
resolved "https://registry.yarnpkg.com/@types/json-schema/-/json-schema-7.0.4.tgz#38fd73ddfd9b55abb1e1b2ed578cb55bd7b7d339"
"@types/node@*", "@types/node@14.0.14", "@types/node@>= 8":
version "14.0.14"
resolved "https://registry.yarnpkg.com/@types/node/-/node-14.0.14.tgz#24a0b5959f16ac141aeb0c5b3cd7a15b7c64cbce"
"@types/node@*", "@types/node@14.0.23", "@types/node@>= 8":
version "14.0.23"
resolved "https://registry.yarnpkg.com/@types/node/-/node-14.0.23.tgz#676fa0883450ed9da0bb24156213636290892806"
"@types/normalize-package-data@^2.4.0":
version "2.4.0"
@ -1762,9 +1762,9 @@ eslint-plugin-import@>=2.18.2:
read-pkg-up "^2.0.0"
resolve "^1.12.0"
eslint-plugin-jest@23.17.1:
version "23.17.1"
resolved "https://registry.yarnpkg.com/eslint-plugin-jest/-/eslint-plugin-jest-23.17.1.tgz#c0f39ba78e0f33b7ee1ce4ec92b773e39026ea3f"
eslint-plugin-jest@23.18.0:
version "23.18.0"
resolved "https://registry.yarnpkg.com/eslint-plugin-jest/-/eslint-plugin-jest-23.18.0.tgz#4813eacb181820ed13c5505f400956d176b25af8"
dependencies:
"@typescript-eslint/experimental-utils" "^2.5.0"
@ -1850,9 +1850,9 @@ eslint-visitor-keys@^1.0.0, eslint-visitor-keys@^1.1.0, eslint-visitor-keys@^1.2
version "1.2.0"
resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-1.2.0.tgz#74415ac884874495f78ec2a97349525344c981fa"
eslint@7.3.1:
version "7.3.1"
resolved "https://registry.yarnpkg.com/eslint/-/eslint-7.3.1.tgz#76392bd7e44468d046149ba128d1566c59acbe19"
eslint@7.4.0:
version "7.4.0"
resolved "https://registry.yarnpkg.com/eslint/-/eslint-7.4.0.tgz#4e35a2697e6c1972f9d6ef2b690ad319f80f206f"
dependencies:
"@babel/code-frame" "^7.0.0"
ajv "^6.10.0"