mirror of
https://github.com/JamesIves/github-pages-deploy-action.git
synced 2023-12-15 20:03:39 +08:00
[Issue-80] Adds target folder option (#82)
* Bump @actions/exec from 1.0.1 to 1.0.2 Bumps [@actions/exec](https://github.com/actions/toolkit/tree/HEAD/packages/exec) from 1.0.1 to 1.0.2. - [Release notes](https://github.com/actions/toolkit/releases) - [Commits](https://github.com/actions/toolkit/commits/HEAD/packages/exec) Signed-off-by: dependabot-preview[bot] <support@dependabot.com> * Adds target directory * Target Folder Docs
This commit is contained in:
parent
0968ee3d9d
commit
771cc5a24a
@ -108,6 +108,7 @@ Below you'll find a description of what each option does.
|
|||||||
| `BRANCH` | This is the branch you wish to deploy to, for example `gh-pages` or `docs`. | `with` | **Yes** |
|
| `BRANCH` | This is the branch you wish to deploy to, for example `gh-pages` or `docs`. | `with` | **Yes** |
|
||||||
| `FOLDER` | The folder in your repository that you want to deploy. If your build script compiles into a directory named `build` you'd put it here. **Folder paths cannot have a leading `/` or `./`**. If you wish to deploy the root directory you can place a `.` here. | `with` | **Yes** |
|
| `FOLDER` | The folder in your repository that you want to deploy. If your build script compiles into a directory named `build` you'd put it here. **Folder paths cannot have a leading `/` or `./`**. If you wish to deploy the root directory you can place a `.` here. | `with` | **Yes** |
|
||||||
| `BASE_BRANCH` | The base branch of your repository which you'd like to checkout prior to deploying. This defaults to `master`. | `with` | **No** |
|
| `BASE_BRANCH` | The base branch of your repository which you'd like to checkout prior to deploying. This defaults to `master`. | `with` | **No** |
|
||||||
|
| `TARGET_FOLDER` | If you'd like to push the contents of the deployment folder into a specific directory on the deployment branch you can specify it here. | `with` | **No** |
|
||||||
| `CLEAN` | If your project generates hashed files on build you can use this option to automatically delete them from the deployment branch with each deploy. This option can be toggled on by setting it to `true`. | `with` | **No** |
|
| `CLEAN` | If your project generates hashed files on build you can use this option to automatically delete them from the deployment branch with each deploy. This option can be toggled on by setting it to `true`. | `with` | **No** |
|
||||||
|
|
||||||
With the action correctly configured you should see the workflow trigger the deployment under the configured conditions.
|
With the action correctly configured you should see the workflow trigger the deployment under the configured conditions.
|
||||||
|
@ -23,6 +23,7 @@ exports.action = {
|
|||||||
gitHubToken: core.getInput("GITHUB_TOKEN"),
|
gitHubToken: core.getInput("GITHUB_TOKEN"),
|
||||||
accessToken: core.getInput("ACCESS_TOKEN"),
|
accessToken: core.getInput("ACCESS_TOKEN"),
|
||||||
branch: core.getInput("BRANCH"),
|
branch: core.getInput("BRANCH"),
|
||||||
|
targetFolder: core.getInput("TARGET_FOLDER"),
|
||||||
baseBranch: core.getInput("BASE_BRANCH") || "master",
|
baseBranch: core.getInput("BASE_BRANCH") || "master",
|
||||||
name: pusher && pusher.name
|
name: pusher && pusher.name
|
||||||
? pusher.name
|
? pusher.name
|
||||||
|
@ -92,7 +92,9 @@ function deploy() {
|
|||||||
Pushes all of the build files into the deployment directory.
|
Pushes all of the build files into the deployment directory.
|
||||||
Allows the user to specify the root if '.' is provided.
|
Allows the user to specify the root if '.' is provided.
|
||||||
rysync is used to prevent file duplication. */
|
rysync is used to prevent file duplication. */
|
||||||
yield util_1.execute(`rsync -q -av --progress ${constants_1.action.build}/. ${temporaryDeploymentDirectory} ${constants_1.action.clean ? `--delete --exclude CNAME --exclude .nojekyll` : ""} --exclude .git --exclude .github ${constants_1.action.build === constants_1.root ? `--exclude ${temporaryDeploymentDirectory}` : ""}`, constants_1.workspace);
|
yield util_1.execute(`rsync -q -av --progress ${constants_1.action.build}/. ${constants_1.action.targetFolder
|
||||||
|
? `${temporaryDeploymentDirectory}/${constants_1.action.targetFolder}`
|
||||||
|
: temporaryDeploymentDirectory} ${constants_1.action.clean ? `--delete --exclude CNAME --exclude .nojekyll` : ""} --exclude .git --exclude .github ${constants_1.action.build === constants_1.root ? `--exclude ${temporaryDeploymentDirectory}` : ""}`, constants_1.workspace);
|
||||||
const hasFilesToCommit = yield util_1.execute(`git status --porcelain`, temporaryDeploymentDirectory);
|
const hasFilesToCommit = yield util_1.execute(`git status --porcelain`, temporaryDeploymentDirectory);
|
||||||
if (!hasFilesToCommit && !constants_1.isTest) {
|
if (!hasFilesToCommit && !constants_1.isTest) {
|
||||||
console.log("There is nothing to commit. Exiting...");
|
console.log("There is nothing to commit. Exiting...");
|
||||||
|
@ -18,6 +18,7 @@ export const action = {
|
|||||||
gitHubToken: core.getInput("GITHUB_TOKEN"),
|
gitHubToken: core.getInput("GITHUB_TOKEN"),
|
||||||
accessToken: core.getInput("ACCESS_TOKEN"),
|
accessToken: core.getInput("ACCESS_TOKEN"),
|
||||||
branch: core.getInput("BRANCH"),
|
branch: core.getInput("BRANCH"),
|
||||||
|
targetFolder: core.getInput("TARGET_FOLDER"),
|
||||||
baseBranch: core.getInput("BASE_BRANCH") || "master",
|
baseBranch: core.getInput("BASE_BRANCH") || "master",
|
||||||
name:
|
name:
|
||||||
pusher && pusher.name
|
pusher && pusher.name
|
||||||
|
@ -87,9 +87,11 @@ export async function deploy(): Promise<any> {
|
|||||||
Allows the user to specify the root if '.' is provided.
|
Allows the user to specify the root if '.' is provided.
|
||||||
rysync is used to prevent file duplication. */
|
rysync is used to prevent file duplication. */
|
||||||
await execute(
|
await execute(
|
||||||
`rsync -q -av --progress ${
|
`rsync -q -av --progress ${action.build}/. ${
|
||||||
action.build
|
action.targetFolder
|
||||||
}/. ${temporaryDeploymentDirectory} ${
|
? `${temporaryDeploymentDirectory}/${action.targetFolder}`
|
||||||
|
: temporaryDeploymentDirectory
|
||||||
|
} ${
|
||||||
action.clean ? `--delete --exclude CNAME --exclude .nojekyll` : ""
|
action.clean ? `--delete --exclude CNAME --exclude .nojekyll` : ""
|
||||||
} --exclude .git --exclude .github ${
|
} --exclude .git --exclude .github ${
|
||||||
action.build === root ? `--exclude ${temporaryDeploymentDirectory}` : ""
|
action.build === root ? `--exclude ${temporaryDeploymentDirectory}` : ""
|
||||||
|
Loading…
Reference in New Issue
Block a user