Set default branch to gh-pages (fix #1151) (#1155)

* Set default branch to gh-pages (fix #1151)

* Fix documented requirement of branch
This commit is contained in:
Nick McCurdy 2022-06-26 08:51:18 -04:00 committed by GitHub
parent f7f029d32e
commit c0e8d739fd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 18 additions and 28 deletions

View File

@ -34,7 +34,6 @@ jobs:
git-config-email: montezuma@jamesiv.es git-config-email: montezuma@jamesiv.es
repository-name: MontezumaIves/lab repository-name: MontezumaIves/lab
token: ${{ secrets.ACCESS_TOKEN }} token: ${{ secrets.ACCESS_TOKEN }}
branch: gh-pages
folder: integration folder: integration
single-commit: true single-commit: true
clean: true clean: true
@ -52,7 +51,6 @@ jobs:
uses: JamesIves/github-pages-deploy-action@v4.3.3 uses: JamesIves/github-pages-deploy-action@v4.3.3
with: with:
token: ${{ secrets.ACCESS_TOKEN }} token: ${{ secrets.ACCESS_TOKEN }}
branch: gh-pages
folder: integration folder: integration
target-folder: cat/montezuma target-folder: cat/montezuma
git-config-name: Montezuma git-config-name: Montezuma
@ -63,7 +61,6 @@ jobs:
uses: dawidd6/action-delete-branch@v3.1.0 uses: dawidd6/action-delete-branch@v3.1.0
with: with:
github_token: ${{ secrets.GITHUB_TOKEN }} github_token: ${{ secrets.GITHUB_TOKEN }}
branches: gh-pages
# Deploys using checkout@v2 with a GITHUB_TOKEN. # Deploys using checkout@v2 with a GITHUB_TOKEN.
integration-checkout-v2: integration-checkout-v2:
@ -78,7 +75,6 @@ jobs:
- name: Build and Deploy - name: Build and Deploy
uses: JamesIves/github-pages-deploy-action@v4.3.3 uses: JamesIves/github-pages-deploy-action@v4.3.3
with: with:
branch: gh-pages
folder: integration folder: integration
target-folder: cat/montezuma2 target-folder: cat/montezuma2
silent: true silent: true
@ -87,7 +83,6 @@ jobs:
uses: dawidd6/action-delete-branch@v3.1.0 uses: dawidd6/action-delete-branch@v3.1.0
with: with:
github_token: ${{ secrets.GITHUB_TOKEN }} github_token: ${{ secrets.GITHUB_TOKEN }}
branches: gh-pages
# Deploys using a container that requires you to install rsync. # Deploys using a container that requires you to install rsync.
integration-container: integration-container:
@ -110,7 +105,6 @@ jobs:
- name: Build and Deploy - name: Build and Deploy
uses: JamesIves/github-pages-deploy-action@v4.3.3 uses: JamesIves/github-pages-deploy-action@v4.3.3
with: with:
branch: gh-pages
folder: integration folder: integration
target-folder: cat/montezuma2 target-folder: cat/montezuma2
silent: true silent: true
@ -135,7 +129,6 @@ jobs:
uses: JamesIves/github-pages-deploy-action@v4.3.3 uses: JamesIves/github-pages-deploy-action@v4.3.3
with: with:
ssh-key: ${{ secrets.DEPLOY_KEY }} ssh-key: ${{ secrets.DEPLOY_KEY }}
branch: gh-pages
folder: integration folder: integration
target-folder: cat/montezuma3 target-folder: cat/montezuma3
silent: true silent: true
@ -165,7 +158,6 @@ jobs:
uses: JamesIves/github-pages-deploy-action@v4.3.3 uses: JamesIves/github-pages-deploy-action@v4.3.3
with: with:
ssh-key: true ssh-key: true
branch: gh-pages
folder: integration folder: integration
target-folder: cat/montezuma4 target-folder: cat/montezuma4
silent: true silent: true
@ -174,7 +166,6 @@ jobs:
uses: dawidd6/action-delete-branch@v3.1.0 uses: dawidd6/action-delete-branch@v3.1.0
with: with:
github_token: ${{ secrets.GITHUB_TOKEN }} github_token: ${{ secrets.GITHUB_TOKEN }}
branches: gh-pages
# Deploys using a custom env. (Includes subsequent commit) # Deploys using a custom env. (Includes subsequent commit)
integration-env: integration-env:
@ -194,7 +185,6 @@ jobs:
uses: JamesIves/github-pages-deploy-action@v4.3.3 uses: JamesIves/github-pages-deploy-action@v4.3.3
with: with:
ssh-key: ${{ secrets.DEPLOY_KEY }} ssh-key: ${{ secrets.DEPLOY_KEY }}
branch: gh-pages
folder: integration folder: integration
target-folder: cat/montezuma4 target-folder: cat/montezuma4
silent: true silent: true
@ -203,7 +193,6 @@ jobs:
uses: JamesIves/github-pages-deploy-action@v4.3.3 uses: JamesIves/github-pages-deploy-action@v4.3.3
with: with:
ssh-key: ${{ secrets.DEPLOY_KEY }} ssh-key: ${{ secrets.DEPLOY_KEY }}
branch: gh-pages
folder: integration folder: integration
target-folder: cat/subsequent target-folder: cat/subsequent
silent: true silent: true
@ -236,7 +225,6 @@ jobs:
uses: JamesIves/github-pages-deploy-action@v4.3.3 uses: JamesIves/github-pages-deploy-action@v4.3.3
with: with:
token: ${{ secrets.ACCESS_TOKEN }} token: ${{ secrets.ACCESS_TOKEN }}
branch: gh-pages
folder: integration folder: integration
clean: true clean: true
silent: true silent: true

View File

@ -77,7 +77,6 @@ jobs:
- name: Deploy 🚀 - name: Deploy 🚀
uses: JamesIves/github-pages-deploy-action@v4.3.3 uses: JamesIves/github-pages-deploy-action@v4.3.3
with: with:
branch: gh-pages # The branch the action should deploy to.
folder: build # The folder the action should deploy. folder: build # The folder the action should deploy.
``` ```
@ -126,7 +125,6 @@ import run from '@jamesives/github-pages-deploy-action'
run({ run({
token: process.env['ACCESS_TOKEN'], token: process.env['ACCESS_TOKEN'],
branch: 'gh-pages',
folder: 'build', folder: 'build',
repositoryName: 'JamesIves/github-pages-deploy-action', repositoryName: 'JamesIves/github-pages-deploy-action',
silent: true, silent: true,
@ -146,7 +144,6 @@ The following options must be configured in order to make a deployment.
| Key | Value Information | Type | Required | | 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** | | `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. 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 | | 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-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** | | `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** | | `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 🚀 - name: Deploy 🚀
uses: JamesIves/github-pages-deploy-action@v4.3.3 uses: JamesIves/github-pages-deploy-action@v4.3.3
with: with:
branch: gh-pages
folder: site folder: site
ssh-key: ${{ secrets.DEPLOY_KEY }} ssh-key: ${{ secrets.DEPLOY_KEY }}
``` ```
@ -235,7 +232,6 @@ jobs:
- name: Deploy 🚀 - name: Deploy 🚀
uses: JamesIves/github-pages-deploy-action@v4.3.3 uses: JamesIves/github-pages-deploy-action@v4.3.3
with: with:
branch: gh-pages
folder: build folder: build
clean: true clean: true
clean-exclude: | clean-exclude: |
@ -305,7 +301,6 @@ jobs:
- name: Deploy 🚀 - name: Deploy 🚀
uses: JamesIves/github-pages-deploy-action@v4.3.3 uses: JamesIves/github-pages-deploy-action@v4.3.3
with: 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. 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 🚀 - name: Deploy 🚀
uses: JamesIves/github-pages-deploy-action@v4.3.3 uses: JamesIves/github-pages-deploy-action@v4.3.3
with: with:
branch: gh-pages
folder: build folder: build
clean: true clean: true
clean-exclude: | clean-exclude: |

View File

@ -33,7 +33,8 @@ inputs:
branch: branch:
description: 'This is the branch you wish to deploy to, for example gh-pages or docs.' description: 'This is the branch you wish to deploy to, for example gh-pages or docs.'
required: true required: false
default: gh-pages
folder: 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.' 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.'

View File

@ -63,7 +63,7 @@ export interface ActionInterface {
/** The minimum required values to run the action as a node module. */ /** The minimum required values to run the action as a node module. */
export interface NodeActionInterface { export interface NodeActionInterface {
/** The branch that the action should deploy to. */ /** The branch that the action should deploy to. */
branch: string branch?: string
/** The folder to deploy. */ /** The folder to deploy. */
folder: string folder: string
/** The repository path, for example JamesIves/github-pages-deploy-action. */ /** The repository path, for example JamesIves/github-pages-deploy-action. */

View File

@ -7,7 +7,8 @@ import {
extractErrorMessage, extractErrorMessage,
generateFolderPath, generateFolderPath,
generateRepositoryPath, generateRepositoryPath,
generateTokenType generateTokenType,
isNullOrUndefined
} from './util' } from './util'
/** Initializes and runs the action. /** Initializes and runs the action.
@ -50,7 +51,11 @@ export default async function run(
info('Checking configuration and starting deployment… 🚦') info('Checking configuration and starting deployment… 🚦')
const settings: ActionInterface = { 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. // Defines the repository/folder paths and token types.

View File

@ -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. /* 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. */ 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 === '' typeof value === 'undefined' || value === null || value === ''
/* Generates a token type used for the action. */ /* Generates a token type used for the action. */