mirror of
https://github.com/JamesIves/github-pages-deploy-action.git
synced 2023-12-15 20:03:39 +08:00
* Set default branch to gh-pages (fix #1151) * Fix documented requirement of branch
This commit is contained in:
parent
f7f029d32e
commit
c0e8d739fd
12
.github/workflows/integration.yml
vendored
12
.github/workflows/integration.yml
vendored
@ -34,7 +34,6 @@ jobs:
|
||||
git-config-email: montezuma@jamesiv.es
|
||||
repository-name: MontezumaIves/lab
|
||||
token: ${{ secrets.ACCESS_TOKEN }}
|
||||
branch: gh-pages
|
||||
folder: integration
|
||||
single-commit: true
|
||||
clean: true
|
||||
@ -52,7 +51,6 @@ jobs:
|
||||
uses: JamesIves/github-pages-deploy-action@v4.3.3
|
||||
with:
|
||||
token: ${{ secrets.ACCESS_TOKEN }}
|
||||
branch: gh-pages
|
||||
folder: integration
|
||||
target-folder: cat/montezuma
|
||||
git-config-name: Montezuma
|
||||
@ -63,7 +61,6 @@ jobs:
|
||||
uses: dawidd6/action-delete-branch@v3.1.0
|
||||
with:
|
||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
branches: gh-pages
|
||||
|
||||
# Deploys using checkout@v2 with a GITHUB_TOKEN.
|
||||
integration-checkout-v2:
|
||||
@ -78,7 +75,6 @@ jobs:
|
||||
- name: Build and Deploy
|
||||
uses: JamesIves/github-pages-deploy-action@v4.3.3
|
||||
with:
|
||||
branch: gh-pages
|
||||
folder: integration
|
||||
target-folder: cat/montezuma2
|
||||
silent: true
|
||||
@ -87,7 +83,6 @@ jobs:
|
||||
uses: dawidd6/action-delete-branch@v3.1.0
|
||||
with:
|
||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
branches: gh-pages
|
||||
|
||||
# Deploys using a container that requires you to install rsync.
|
||||
integration-container:
|
||||
@ -110,7 +105,6 @@ jobs:
|
||||
- name: Build and Deploy
|
||||
uses: JamesIves/github-pages-deploy-action@v4.3.3
|
||||
with:
|
||||
branch: gh-pages
|
||||
folder: integration
|
||||
target-folder: cat/montezuma2
|
||||
silent: true
|
||||
@ -135,7 +129,6 @@ jobs:
|
||||
uses: JamesIves/github-pages-deploy-action@v4.3.3
|
||||
with:
|
||||
ssh-key: ${{ secrets.DEPLOY_KEY }}
|
||||
branch: gh-pages
|
||||
folder: integration
|
||||
target-folder: cat/montezuma3
|
||||
silent: true
|
||||
@ -165,7 +158,6 @@ jobs:
|
||||
uses: JamesIves/github-pages-deploy-action@v4.3.3
|
||||
with:
|
||||
ssh-key: true
|
||||
branch: gh-pages
|
||||
folder: integration
|
||||
target-folder: cat/montezuma4
|
||||
silent: true
|
||||
@ -174,7 +166,6 @@ jobs:
|
||||
uses: dawidd6/action-delete-branch@v3.1.0
|
||||
with:
|
||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
branches: gh-pages
|
||||
|
||||
# Deploys using a custom env. (Includes subsequent commit)
|
||||
integration-env:
|
||||
@ -194,7 +185,6 @@ jobs:
|
||||
uses: JamesIves/github-pages-deploy-action@v4.3.3
|
||||
with:
|
||||
ssh-key: ${{ secrets.DEPLOY_KEY }}
|
||||
branch: gh-pages
|
||||
folder: integration
|
||||
target-folder: cat/montezuma4
|
||||
silent: true
|
||||
@ -203,7 +193,6 @@ jobs:
|
||||
uses: JamesIves/github-pages-deploy-action@v4.3.3
|
||||
with:
|
||||
ssh-key: ${{ secrets.DEPLOY_KEY }}
|
||||
branch: gh-pages
|
||||
folder: integration
|
||||
target-folder: cat/subsequent
|
||||
silent: true
|
||||
@ -236,7 +225,6 @@ jobs:
|
||||
uses: JamesIves/github-pages-deploy-action@v4.3.3
|
||||
with:
|
||||
token: ${{ secrets.ACCESS_TOKEN }}
|
||||
branch: gh-pages
|
||||
folder: integration
|
||||
clean: true
|
||||
silent: true
|
||||
|
@ -77,7 +77,6 @@ jobs:
|
||||
- name: Deploy 🚀
|
||||
uses: JamesIves/github-pages-deploy-action@v4.3.3
|
||||
with:
|
||||
branch: gh-pages # The branch the action should deploy to.
|
||||
folder: build # The folder the action should deploy.
|
||||
```
|
||||
|
||||
@ -126,7 +125,6 @@ import run from '@jamesives/github-pages-deploy-action'
|
||||
|
||||
run({
|
||||
token: process.env['ACCESS_TOKEN'],
|
||||
branch: 'gh-pages',
|
||||
folder: 'build',
|
||||
repositoryName: 'JamesIves/github-pages-deploy-action',
|
||||
silent: true,
|
||||
@ -146,7 +144,6 @@ The following options must be configured in order to make a deployment.
|
||||
|
||||
| Key | Value Information | Type | Required |
|
||||
| -------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------ | -------- |
|
||||
| `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. If you wish to deploy the root directory you can place a `.` here. You can also utilize absolute file paths by appending `~` to your folder path. | `with` | **Yes** |
|
||||
|
||||
By default, the action does not need any token configuration and uses the provided repository scoped GitHub token to make the deployment. If you require more customization you can modify the deployment type using the following options.
|
||||
@ -160,6 +157,7 @@ By default, the action does not need any token configuration and uses the provid
|
||||
|
||||
| Key | Value Information | Type | Required |
|
||||
| ------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------ | -------- |
|
||||
| `branch` | This is the branch you wish to deploy to, for example, `gh-pages` or `docs`. | `with` | **No** |
|
||||
| `git-config-name` | Allows you to customize the name that is attached to the git config which is used when pushing the deployment commits. If this is not included it will use the name in the GitHub context, followed by the name of the action. | `with` | **No** |
|
||||
| `git-config-email` | Allows you to customize the email that is attached to the git config which is used when pushing the deployment commits. If this is not included it will use the email in the GitHub context, followed by a generic noreply GitHub email. You can include `<>` for the value if you wish to omit this field altogether and push the commits without an email. | `with` | **No** |
|
||||
| `repository-name` | Allows you to specify a different repository path so long as you have permissions to push to it. This should be formatted like so: `JamesIves/github-pages-deploy-action`. You'll need to use a PAT in the `token` input for this configuration option to work properly. | `with` | **No** |
|
||||
@ -205,7 +203,6 @@ With this configured, you can then set the `ssh-key` part of the action to your
|
||||
- name: Deploy 🚀
|
||||
uses: JamesIves/github-pages-deploy-action@v4.3.3
|
||||
with:
|
||||
branch: gh-pages
|
||||
folder: site
|
||||
ssh-key: ${{ secrets.DEPLOY_KEY }}
|
||||
```
|
||||
@ -235,7 +232,6 @@ jobs:
|
||||
- name: Deploy 🚀
|
||||
uses: JamesIves/github-pages-deploy-action@v4.3.3
|
||||
with:
|
||||
branch: gh-pages
|
||||
folder: build
|
||||
clean: true
|
||||
clean-exclude: |
|
||||
@ -305,7 +301,6 @@ jobs:
|
||||
- name: Deploy 🚀
|
||||
uses: JamesIves/github-pages-deploy-action@v4.3.3
|
||||
with:
|
||||
branch: gh-pages
|
||||
folder: 'site' # The deployment folder should match the name of the artifact. Even though our project builds into the 'build' folder the artifact name of 'site' must be placed here.
|
||||
```
|
||||
|
||||
@ -360,7 +355,6 @@ jobs:
|
||||
- name: Deploy 🚀
|
||||
uses: JamesIves/github-pages-deploy-action@v4.3.3
|
||||
with:
|
||||
branch: gh-pages
|
||||
folder: build
|
||||
clean: true
|
||||
clean-exclude: |
|
||||
|
@ -33,7 +33,8 @@ inputs:
|
||||
|
||||
branch:
|
||||
description: 'This is the branch you wish to deploy to, for example gh-pages or docs.'
|
||||
required: true
|
||||
required: false
|
||||
default: gh-pages
|
||||
|
||||
folder:
|
||||
description: 'The folder in your repository that you want to deploy. If your build script compiles into a directory named build you would put it here. Folder paths cannot have a leading / or ./. If you wish to deploy the root directory you can place a . here.'
|
||||
|
@ -63,7 +63,7 @@ export interface ActionInterface {
|
||||
/** The minimum required values to run the action as a node module. */
|
||||
export interface NodeActionInterface {
|
||||
/** The branch that the action should deploy to. */
|
||||
branch: string
|
||||
branch?: string
|
||||
/** The folder to deploy. */
|
||||
folder: string
|
||||
/** The repository path, for example JamesIves/github-pages-deploy-action. */
|
||||
|
@ -7,7 +7,8 @@ import {
|
||||
extractErrorMessage,
|
||||
generateFolderPath,
|
||||
generateRepositoryPath,
|
||||
generateTokenType
|
||||
generateTokenType,
|
||||
isNullOrUndefined
|
||||
} from './util'
|
||||
|
||||
/** Initializes and runs the action.
|
||||
@ -50,7 +51,11 @@ export default async function run(
|
||||
info('Checking configuration and starting deployment… 🚦')
|
||||
|
||||
const settings: ActionInterface = {
|
||||
...configuration
|
||||
...configuration,
|
||||
// Set the default branch for Node configurations
|
||||
branch: !isNullOrUndefined(configuration.branch)
|
||||
? configuration.branch
|
||||
: 'gh-pages'
|
||||
}
|
||||
|
||||
// Defines the repository/folder paths and token types.
|
||||
|
@ -14,7 +14,9 @@ const replaceAll = (input: string, find: string, replace: string): string =>
|
||||
|
||||
/* Utility function that checks to see if a value is undefined or not.
|
||||
If allowEmptyString is passed the parameter is allowed to contain an empty string as a valid parameter. */
|
||||
export const isNullOrUndefined = (value: unknown): boolean =>
|
||||
export const isNullOrUndefined = (
|
||||
value: unknown
|
||||
): value is undefined | null | '' =>
|
||||
typeof value === 'undefined' || value === null || value === ''
|
||||
|
||||
/* Generates a token type used for the action. */
|
||||
|
Loading…
Reference in New Issue
Block a user