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
ec7903d337
7
.github/workflows/build.yml
vendored
7
.github/workflows/build.yml
vendored
@ -1,14 +1,11 @@
|
|||||||
name: unit-tests
|
name: unit-tests
|
||||||
on:
|
on: [pull_request, push]
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- dev
|
|
||||||
jobs:
|
jobs:
|
||||||
unit-test:
|
unit-test:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@master
|
uses: actions/checkout@v1
|
||||||
|
|
||||||
- name: Install and Test
|
- name: Install and Test
|
||||||
run: |
|
run: |
|
||||||
|
9
.github/workflows/integration.yml
vendored
9
.github/workflows/integration.yml
vendored
@ -7,11 +7,12 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@master
|
uses: actions/checkout@v1
|
||||||
|
|
||||||
- name: Build and Deploy
|
- name: Build and Deploy
|
||||||
uses: JamesIves/github-pages-deploy-action@master
|
uses: JamesIves/github-pages-deploy-action@releases/v3
|
||||||
env:
|
with:
|
||||||
ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }}
|
ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }}
|
||||||
BRANCH: gh-pages
|
BRANCH: gh-pages
|
||||||
FOLDER: 'integration'
|
FOLDER: integration
|
||||||
|
BASE_BRANCH: dev
|
||||||
|
1
__tests__/env.js
Normal file
1
__tests__/env.js
Normal file
@ -0,0 +1 @@
|
|||||||
|
process.env.UNIT_TEST = true
|
@ -136,7 +136,7 @@ describe("git", () => {
|
|||||||
const call = await deploy();
|
const call = await deploy();
|
||||||
|
|
||||||
// Includes the call to generateBranch
|
// Includes the call to generateBranch
|
||||||
expect(execute).toBeCalledTimes(14);
|
expect(execute).toBeCalledTimes(15);
|
||||||
expect(cp).toBeCalledTimes(1)
|
expect(cp).toBeCalledTimes(1)
|
||||||
expect(call).toBe('Commit step complete...')
|
expect(call).toBe('Commit step complete...')
|
||||||
})
|
})
|
||||||
@ -153,7 +153,7 @@ describe("git", () => {
|
|||||||
const call = await deploy();
|
const call = await deploy();
|
||||||
|
|
||||||
// Includes the call to generateBranch
|
// Includes the call to generateBranch
|
||||||
expect(execute).toBeCalledTimes(15);
|
expect(execute).toBeCalledTimes(16);
|
||||||
expect(cp).toBeCalledTimes(0)
|
expect(cp).toBeCalledTimes(0)
|
||||||
expect(call).toBe('Commit step complete...')
|
expect(call).toBe('Commit step complete...')
|
||||||
})
|
})
|
||||||
|
@ -7,5 +7,6 @@ module.exports = {
|
|||||||
transform: {
|
transform: {
|
||||||
'^.+\\.ts$': 'ts-jest'
|
'^.+\\.ts$': 'ts-jest'
|
||||||
},
|
},
|
||||||
verbose: true
|
verbose: true,
|
||||||
|
setupFiles: ["<rootDir>/__tests__/env.js"]
|
||||||
}
|
}
|
@ -13,6 +13,7 @@ const { pusher, repository } = github.context.payload;
|
|||||||
exports.workspace = process.env.GITHUB_WORKSPACE;
|
exports.workspace = process.env.GITHUB_WORKSPACE;
|
||||||
exports.folder = core.getInput("FOLDER", { required: true });
|
exports.folder = core.getInput("FOLDER", { required: true });
|
||||||
exports.root = ".";
|
exports.root = ".";
|
||||||
|
exports.isTest = process.env.UNIT_TEST;
|
||||||
// Required action data.
|
// Required action data.
|
||||||
exports.action = {
|
exports.action = {
|
||||||
build: exports.folder,
|
build: exports.folder,
|
||||||
|
@ -103,8 +103,8 @@ function deploy() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
const hasFilesToCommit = yield util_1.execute(`git status --porcelain`, temporaryDeploymentDirectory);
|
const hasFilesToCommit = yield util_1.execute(`git status --porcelain`, temporaryDeploymentDirectory);
|
||||||
if (!hasFilesToCommit) {
|
if (!hasFilesToCommit && !constants_1.isTest) {
|
||||||
console.log('There is nothing to commit. Exiting...');
|
console.log("There is nothing to commit. Exiting...");
|
||||||
return Promise.resolve();
|
return Promise.resolve();
|
||||||
}
|
}
|
||||||
// Commits to GitHub.
|
// Commits to GitHub.
|
||||||
|
@ -6,6 +6,7 @@ const { pusher, repository } = github.context.payload;
|
|||||||
export const workspace: any = process.env.GITHUB_WORKSPACE;
|
export const workspace: any = process.env.GITHUB_WORKSPACE;
|
||||||
export const folder = core.getInput("FOLDER", { required: true });
|
export const folder = core.getInput("FOLDER", { required: true });
|
||||||
export const root = ".";
|
export const root = ".";
|
||||||
|
export const isTest = process.env.UNIT_TEST;
|
||||||
|
|
||||||
// Required action data.
|
// Required action data.
|
||||||
export const action = {
|
export const action = {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import * as core from "@actions/core";
|
import * as core from "@actions/core";
|
||||||
import { cp } from "@actions/io";
|
import { cp } from "@actions/io";
|
||||||
import { execute } from "./util";
|
import { execute } from "./util";
|
||||||
import { workspace, action, root, repositoryPath } from "./constants";
|
import { workspace, action, root, repositoryPath, isTest } from "./constants";
|
||||||
|
|
||||||
/** Generates the branch if it doesn't exist on the remote.
|
/** Generates the branch if it doesn't exist on the remote.
|
||||||
* @returns {Promise}
|
* @returns {Promise}
|
||||||
@ -104,7 +104,7 @@ export async function deploy(): Promise<any> {
|
|||||||
temporaryDeploymentDirectory
|
temporaryDeploymentDirectory
|
||||||
);
|
);
|
||||||
|
|
||||||
if (!hasFilesToCommit) {
|
if (!hasFilesToCommit && !isTest) {
|
||||||
console.log("There is nothing to commit. Exiting...");
|
console.log("There is nothing to commit. Exiting...");
|
||||||
return Promise.resolve();
|
return Promise.resolve();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user