mirror of
https://github.com/JamesIves/github-pages-deploy-action.git
synced 2023-12-15 20:03:39 +08:00
parent
43e20fe3ca
commit
a7cf017c75
2
.github/dependabot.yml
vendored
2
.github/dependabot.yml
vendored
@ -12,4 +12,4 @@ updates:
|
||||
schedule:
|
||||
interval: daily
|
||||
time: '10:00'
|
||||
open-pull-requests-limit: 10
|
||||
open-pull-requests-limit: 10
|
||||
|
2
.github/workflows/integration.yml
vendored
2
.github/workflows/integration.yml
vendored
@ -218,7 +218,7 @@ jobs:
|
||||
integration-container,
|
||||
integration-ssh,
|
||||
integration-ssh-third-party-client,
|
||||
integration-env
|
||||
integration-env,
|
||||
]
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
|
@ -75,7 +75,7 @@ on:
|
||||
- main
|
||||
```
|
||||
|
||||
It's recommended that you use [Dependabot](https://docs.github.com/en/code-security/supply-chain-security/managing-vulnerabilities-in-your-projects-dependencies/configuring-dependabot-security-updates) to keep your workflow up-to-date and [secure](https://github.com/features/security). 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).
|
||||
It's recommended that you use [Dependabot](https://docs.github.com/en/code-security/supply-chain-security/keeping-your-dependencies-updated-automatically) to keep your workflow up-to-date and [secure](https://github.com/features/security). 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 📦
|
||||
|
||||
|
@ -55,7 +55,7 @@ describe('git', () => {
|
||||
})
|
||||
|
||||
await init(action)
|
||||
expect(execute).toBeCalledTimes(5)
|
||||
expect(execute).toBeCalledTimes(6)
|
||||
})
|
||||
|
||||
it('should catch when a function throws an error', async () => {
|
||||
@ -102,7 +102,7 @@ describe('git', () => {
|
||||
})
|
||||
|
||||
await init(action)
|
||||
expect(execute).toBeCalledTimes(5)
|
||||
expect(execute).toBeCalledTimes(6)
|
||||
})
|
||||
|
||||
it('should not unset git config if a user is using ssh', async () => {
|
||||
@ -124,7 +124,7 @@ describe('git', () => {
|
||||
})
|
||||
|
||||
await init(action)
|
||||
expect(execute).toBeCalledTimes(4)
|
||||
expect(execute).toBeCalledTimes(5)
|
||||
|
||||
process.env.CI = undefined
|
||||
})
|
||||
@ -145,7 +145,7 @@ describe('git', () => {
|
||||
})
|
||||
|
||||
await init(action)
|
||||
expect(execute).toBeCalledTimes(5)
|
||||
expect(execute).toBeCalledTimes(6)
|
||||
})
|
||||
})
|
||||
|
||||
|
@ -50,7 +50,7 @@ describe('main', () => {
|
||||
debug: true
|
||||
})
|
||||
await run(action)
|
||||
expect(execute).toBeCalledTimes(15)
|
||||
expect(execute).toBeCalledTimes(16)
|
||||
expect(rmRF).toBeCalledTimes(1)
|
||||
expect(exportVariable).toBeCalledTimes(1)
|
||||
})
|
||||
@ -70,7 +70,7 @@ describe('main', () => {
|
||||
isTest: TestFlag.HAS_CHANGED_FILES
|
||||
})
|
||||
await run(action)
|
||||
expect(execute).toBeCalledTimes(18)
|
||||
expect(execute).toBeCalledTimes(19)
|
||||
expect(rmRF).toBeCalledTimes(1)
|
||||
expect(exportVariable).toBeCalledTimes(1)
|
||||
})
|
||||
|
@ -157,3 +157,12 @@ export enum OperatingSystems {
|
||||
}
|
||||
|
||||
export const SupportedOperatingSystems = [OperatingSystems.LINUX]
|
||||
|
||||
/* Excluded files. */
|
||||
export enum DefaultExcludedFiles {
|
||||
CNAME = 'CNAME',
|
||||
NOJEKYLL = '.nojekyll',
|
||||
SSH = '.ssh',
|
||||
GIT = '.git',
|
||||
GITHUB = '.github'
|
||||
}
|
||||
|
30
src/git.ts
30
src/git.ts
@ -1,7 +1,12 @@
|
||||
import {info} from '@actions/core'
|
||||
import {mkdirP, rmRF} from '@actions/io'
|
||||
import fs from 'fs'
|
||||
import {ActionInterface, Status, TestFlag} from './constants'
|
||||
import {
|
||||
ActionInterface,
|
||||
DefaultExcludedFiles,
|
||||
Status,
|
||||
TestFlag
|
||||
} from './constants'
|
||||
import {execute} from './execute'
|
||||
import {generateWorktree} from './worktree'
|
||||
import {
|
||||
@ -21,12 +26,19 @@ export async function init(action: ActionInterface): Promise<void | Error> {
|
||||
action.workspace,
|
||||
action.silent
|
||||
)
|
||||
|
||||
await execute(
|
||||
`git config user.email "${action.email}"`,
|
||||
action.workspace,
|
||||
action.silent
|
||||
)
|
||||
|
||||
await execute(
|
||||
`git config core.ignorecase false`,
|
||||
action.workspace,
|
||||
action.silent
|
||||
)
|
||||
|
||||
try {
|
||||
if ((process.env.CI && !action.sshKey) || action.isTest) {
|
||||
/* Ensures that previously set Git configs do not interfere with the deployment.
|
||||
@ -129,16 +141,22 @@ export async function deploy(action: ActionInterface): Promise<Status> {
|
||||
} ${
|
||||
action.clean
|
||||
? `--delete ${excludes} ${
|
||||
!fs.existsSync(`${action.folderPath}/CNAME`)
|
||||
? '--exclude CNAME'
|
||||
!fs.existsSync(
|
||||
`${action.folderPath}/${DefaultExcludedFiles.CNAME}`
|
||||
)
|
||||
? `--exclude ${DefaultExcludedFiles.CNAME}`
|
||||
: ''
|
||||
} ${
|
||||
!fs.existsSync(`${action.folderPath}/.nojekyll`)
|
||||
? '--exclude .nojekyll'
|
||||
!fs.existsSync(
|
||||
`${action.folderPath}/${DefaultExcludedFiles.NOJEKYLL}`
|
||||
)
|
||||
? `--exclude ${DefaultExcludedFiles.NOJEKYLL}`
|
||||
: ''
|
||||
}`
|
||||
: ''
|
||||
} --exclude .ssh --exclude .git --exclude .github ${
|
||||
} --exclude ${DefaultExcludedFiles.SSH} --exclude ${
|
||||
DefaultExcludedFiles.GIT
|
||||
} --exclude ${DefaultExcludedFiles.GITHUB} ${
|
||||
action.folderPath === action.workspace
|
||||
? `--exclude ${temporaryDeploymentDirectory}`
|
||||
: ''
|
||||
|
Loading…
Reference in New Issue
Block a user