mirror of
https://github.com/JamesIves/github-pages-deploy-action.git
synced 2023-12-15 20:03:39 +08:00
Merge branch 'dev' into releases/v3
This commit is contained in:
commit
5eb7bd324f
4
.gitignore
vendored
4
.gitignore
vendored
@ -7,6 +7,10 @@ yarn-debug.log*
|
|||||||
yarn-error.log*
|
yarn-error.log*
|
||||||
#node_modules
|
#node_modules
|
||||||
|
|
||||||
|
# Test Temp Files
|
||||||
|
assets/.nojekyll
|
||||||
|
assets/CNAME
|
||||||
|
|
||||||
# Build
|
# Build
|
||||||
# lib
|
# lib
|
||||||
|
|
||||||
|
10
README.md
10
README.md
@ -52,7 +52,7 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout 🛎️
|
- 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:
|
with:
|
||||||
persist-credentials: false
|
persist-credentials: false
|
||||||
|
|
||||||
@ -62,7 +62,7 @@ jobs:
|
|||||||
npm run build
|
npm run build
|
||||||
|
|
||||||
- name: Deploy 🚀
|
- name: Deploy 🚀
|
||||||
uses: JamesIves/github-pages-deploy-action@releases/v3
|
uses: JamesIves/github-pages-deploy-action@3.5.7
|
||||||
with:
|
with:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
BRANCH: gh-pages # The branch the action should deploy to.
|
BRANCH: gh-pages # The branch the action should deploy to.
|
||||||
@ -78,6 +78,8 @@ on:
|
|||||||
- master
|
- 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 📦
|
#### 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.
|
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 📁
|
### 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.
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
@ -6,6 +6,7 @@ import {mkdirP, rmRF} from '@actions/io'
|
|||||||
import {action, Status} from '../src/constants'
|
import {action, Status} from '../src/constants'
|
||||||
import {execute} from '../src/execute'
|
import {execute} from '../src/execute'
|
||||||
import {deploy, generateBranch, init, switchToBaseBranch} from '../src/git'
|
import {deploy, generateBranch, init, switchToBaseBranch} from '../src/git'
|
||||||
|
import fs from 'fs';
|
||||||
|
|
||||||
const originalAction = JSON.stringify(action)
|
const originalAction = JSON.stringify(action)
|
||||||
|
|
||||||
@ -362,6 +363,30 @@ describe('git', () => {
|
|||||||
expect(response).toBe(Status.SUCCESS)
|
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 () => {
|
it('should execute commands with single commit toggled', async () => {
|
||||||
Object.assign(action, {
|
Object.assign(action, {
|
||||||
silent: false,
|
silent: false,
|
||||||
@ -382,6 +407,7 @@ describe('git', () => {
|
|||||||
expect(rmRF).toBeCalledTimes(1)
|
expect(rmRF).toBeCalledTimes(1)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
it('should execute commands with clean options, ommits sha commit message', async () => {
|
it('should execute commands with clean options, ommits sha commit message', async () => {
|
||||||
process.env.GITHUB_SHA = ''
|
process.env.GITHUB_SHA = ''
|
||||||
Object.assign(action, {
|
Object.assign(action, {
|
||||||
|
10
package.json
10
package.json
@ -2,7 +2,7 @@
|
|||||||
"name": "@jamesives/github-pages-deploy-action",
|
"name": "@jamesives/github-pages-deploy-action",
|
||||||
"description": "GitHub action for building a project and deploying it to GitHub pages.",
|
"description": "GitHub action for building a project and deploying it to GitHub pages.",
|
||||||
"author": "James Ives <iam@jamesiv.es> (https://jamesiv.es)",
|
"author": "James Ives <iam@jamesiv.es> (https://jamesiv.es)",
|
||||||
"version": "3.5.6",
|
"version": "3.5.7",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"main": "lib/lib.js",
|
"main": "lib/lib.js",
|
||||||
"types": "lib/lib.d.ts",
|
"types": "lib/lib.d.ts",
|
||||||
@ -39,11 +39,11 @@
|
|||||||
"@actions/io": "1.0.2"
|
"@actions/io": "1.0.2"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/jest": "26.0.3",
|
"@types/jest": "26.0.4",
|
||||||
"@types/node": "14.0.14",
|
"@types/node": "14.0.23",
|
||||||
"eslint": "7.3.1",
|
"eslint": "7.4.0",
|
||||||
"eslint-plugin-github": "3.4.1",
|
"eslint-plugin-github": "3.4.1",
|
||||||
"eslint-plugin-jest": "23.17.1",
|
"eslint-plugin-jest": "23.18.0",
|
||||||
"eslint-plugin-prettier": "^3.1.2",
|
"eslint-plugin-prettier": "^3.1.2",
|
||||||
"jest": "25.5.4",
|
"jest": "25.5.4",
|
||||||
"jest-circus": "26.1.0",
|
"jest-circus": "26.1.0",
|
||||||
|
11
src/git.ts
11
src/git.ts
@ -1,5 +1,6 @@
|
|||||||
import {info} from '@actions/core'
|
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 {ActionInterface, Status} from './constants'
|
||||||
import {execute} from './execute'
|
import {execute} from './execute'
|
||||||
import {
|
import {
|
||||||
@ -193,7 +194,13 @@ export async function deploy(action: ActionInterface): Promise<Status> {
|
|||||||
: temporaryDeploymentDirectory
|
: temporaryDeploymentDirectory
|
||||||
} ${
|
} ${
|
||||||
action.clean
|
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 ${
|
} --exclude .ssh --exclude .git --exclude .github ${
|
||||||
action.folder === action.root
|
action.folder === action.root
|
||||||
|
24
yarn.lock
24
yarn.lock
@ -767,9 +767,9 @@
|
|||||||
"@types/istanbul-lib-coverage" "*"
|
"@types/istanbul-lib-coverage" "*"
|
||||||
"@types/istanbul-lib-report" "*"
|
"@types/istanbul-lib-report" "*"
|
||||||
|
|
||||||
"@types/jest@26.0.3":
|
"@types/jest@26.0.4":
|
||||||
version "26.0.3"
|
version "26.0.4"
|
||||||
resolved "https://registry.yarnpkg.com/@types/jest/-/jest-26.0.3.tgz#79534e0e94857171c0edc596db0ebe7cb7863251"
|
resolved "https://registry.yarnpkg.com/@types/jest/-/jest-26.0.4.tgz#d2e513e85aca16992816f192582b5e67b0b15efb"
|
||||||
dependencies:
|
dependencies:
|
||||||
jest-diff "^25.2.1"
|
jest-diff "^25.2.1"
|
||||||
pretty-format "^25.2.1"
|
pretty-format "^25.2.1"
|
||||||
@ -778,9 +778,9 @@
|
|||||||
version "7.0.4"
|
version "7.0.4"
|
||||||
resolved "https://registry.yarnpkg.com/@types/json-schema/-/json-schema-7.0.4.tgz#38fd73ddfd9b55abb1e1b2ed578cb55bd7b7d339"
|
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":
|
"@types/node@*", "@types/node@14.0.23", "@types/node@>= 8":
|
||||||
version "14.0.14"
|
version "14.0.23"
|
||||||
resolved "https://registry.yarnpkg.com/@types/node/-/node-14.0.14.tgz#24a0b5959f16ac141aeb0c5b3cd7a15b7c64cbce"
|
resolved "https://registry.yarnpkg.com/@types/node/-/node-14.0.23.tgz#676fa0883450ed9da0bb24156213636290892806"
|
||||||
|
|
||||||
"@types/normalize-package-data@^2.4.0":
|
"@types/normalize-package-data@^2.4.0":
|
||||||
version "2.4.0"
|
version "2.4.0"
|
||||||
@ -1762,9 +1762,9 @@ eslint-plugin-import@>=2.18.2:
|
|||||||
read-pkg-up "^2.0.0"
|
read-pkg-up "^2.0.0"
|
||||||
resolve "^1.12.0"
|
resolve "^1.12.0"
|
||||||
|
|
||||||
eslint-plugin-jest@23.17.1:
|
eslint-plugin-jest@23.18.0:
|
||||||
version "23.17.1"
|
version "23.18.0"
|
||||||
resolved "https://registry.yarnpkg.com/eslint-plugin-jest/-/eslint-plugin-jest-23.17.1.tgz#c0f39ba78e0f33b7ee1ce4ec92b773e39026ea3f"
|
resolved "https://registry.yarnpkg.com/eslint-plugin-jest/-/eslint-plugin-jest-23.18.0.tgz#4813eacb181820ed13c5505f400956d176b25af8"
|
||||||
dependencies:
|
dependencies:
|
||||||
"@typescript-eslint/experimental-utils" "^2.5.0"
|
"@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"
|
version "1.2.0"
|
||||||
resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-1.2.0.tgz#74415ac884874495f78ec2a97349525344c981fa"
|
resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-1.2.0.tgz#74415ac884874495f78ec2a97349525344c981fa"
|
||||||
|
|
||||||
eslint@7.3.1:
|
eslint@7.4.0:
|
||||||
version "7.3.1"
|
version "7.4.0"
|
||||||
resolved "https://registry.yarnpkg.com/eslint/-/eslint-7.3.1.tgz#76392bd7e44468d046149ba128d1566c59acbe19"
|
resolved "https://registry.yarnpkg.com/eslint/-/eslint-7.4.0.tgz#4e35a2697e6c1972f9d6ef2b690ad319f80f206f"
|
||||||
dependencies:
|
dependencies:
|
||||||
"@babel/code-frame" "^7.0.0"
|
"@babel/code-frame" "^7.0.0"
|
||||||
ajv "^6.10.0"
|
ajv "^6.10.0"
|
||||||
|
Loading…
Reference in New Issue
Block a user