Lowercase Inputs (#547)

* Lowercases inputs

* Adjusts workflow tests and deployment_status
This commit is contained in:
James Ives 2020-12-15 18:32:06 -05:00 committed by GitHub
parent 2a503ef9b5
commit d8c795395d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 95 additions and 293 deletions

View File

@ -93,10 +93,10 @@ jobs:
- name: Deploy
uses: ./
with:
FOLDER: integration
BRANCH: ${{ matrix.branch }}
folder: integration
branch: ${{ matrix.branch }}
SINGLE_COMMIT: ${{ matrix.commit == 'singleCommit' }}
DRY_RUN: true
dry_run: true
- name: Tweak content to publish to existing branch
if: ${{ matrix.branch == 'gh-pages' }}
@ -107,7 +107,7 @@ jobs:
uses: ./
if: ${{ matrix.branch == 'gh-pages' }}
with:
FOLDER: integration
BRANCH: ${{ matrix.branch }}
SINGLE_COMMIT: ${{ matrix.commit == 'singleCommit' }}
DRY_RUN: true
folder: integration
branch: ${{ matrix.branch }}
single_commit: ${{ matrix.commit == 'singleCommit' }}
dry_run: true

View File

@ -1,196 +0,0 @@
name: integration-tests-beta
on:
schedule:
- cron: 30 15 * * 0-6
push:
branches:
- dev
- releases/v3-test
jobs:
# Deploys using checkout@v1 with an ACCESS_TOKEN.
integration-checkout-v1:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v1
- name: Build and Deploy
uses: JamesIves/github-pages-deploy-action@releases/v3-test
with:
ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }}
BRANCH: gh-pages-test
FOLDER: integration
TARGET_FOLDER: cat/montezuma
GIT_CONFIG_NAME: Montezuma
GIT_CONFIG_EMAIL: montezuma@jamesiv.es
- name: Cleanup Generated Branch
uses: dawidd6/action-delete-branch@v2.0.1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branches: gh-pages-test
# Deploys using checkout@v2 with a GITHUB_TOKEN.
integration-checkout-v2:
needs: integration-checkout-v1
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
persist-credentials: false
- name: Build and Deploy
uses: JamesIves/github-pages-deploy-action@releases/v3-test
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BRANCH: gh-pages-test
FOLDER: integration
TARGET_FOLDER: cat/montezuma2
- name: Cleanup Generated Branch
uses: dawidd6/action-delete-branch@v2.0.1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branches: gh-pages-test
# Deploys using a container that requires you to install rsync.
integration-container:
needs: integration-checkout-v2
runs-on: ubuntu-latest
container:
image: ruby:2.6
env:
LANG: C.UTF-8
steps:
- name: Checkout
uses: actions/checkout@v2
with:
persist-credentials: false
- name: Install rsync
run: |
apt-get update && apt-get install -y rsync
- name: Build and Deploy
uses: JamesIves/github-pages-deploy-action@releases/v3-test
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BRANCH: gh-pages-test
FOLDER: integration
TARGET_FOLDER: cat/montezuma2
- name: Cleanup Generated Branch
uses: dawidd6/action-delete-branch@v2.0.1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branches: gh-pages-test
# Deploys using an SSH key.
integration-ssh:
needs: integration-container
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
persist-credentials: false
- name: Install SSH Client
uses: webfactory/ssh-agent@v0.4.1
with:
ssh-private-key: ${{ secrets.DEPLOY_KEY }}
- name: Build and Deploy
uses: JamesIves/github-pages-deploy-action@releases/v3-test
with:
SSH: true
BRANCH: gh-pages-test
FOLDER: integration
TARGET_FOLDER: cat/montezuma3
- name: Cleanup Generated Branch
uses: dawidd6/action-delete-branch@v2.0.1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branches: gh-pages-test
# Deploys using a custom env.
integration-env:
needs: integration-ssh
runs-on: ubuntu-latest
steps:
- uses: actions/setup-node@v1.4.4
with:
node-version: '10.x'
- name: Checkout
uses: actions/checkout@v2
with:
persist-credentials: false
- name: Install SSH Client
uses: webfactory/ssh-agent@v0.4.1
with:
ssh-private-key: ${{ secrets.DEPLOY_KEY }}
- name: Build and Deploy
uses: JamesIves/github-pages-deploy-action@releases/v3-test
with:
SSH: true
BRANCH: gh-pages-test
FOLDER: integration
TARGET_FOLDER: cat/montezuma4
- name: Cleanup Generated Branch
uses: dawidd6/action-delete-branch@v2.0.1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branches: gh-pages-test
# Deploys using the CLEAN option toggled.
integration-clean:
needs: [integration-checkout-v1, integration-checkout-v2, integration-container, integration-ssh, integration-env]
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
persist-credentials: false
- name: Build and Deploy
uses: JamesIves/github-pages-deploy-action@releases/v3-test
with:
ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }}
BRANCH: gh-pages-test
FOLDER: integration
CLEAN: true
# Deploys to a branch that doesn't exist with SINGLE_COMMIT.
integration-branch-creation:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
persist-credentials: false
- name: Build and Deploy
uses: JamesIves/github-pages-deploy-action@releases/v3-test
with:
ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }}
BRANCH: integration-test-delete-beta
FOLDER: integration
SINGLE_COMMIT: true
- name: Cleanup Generated Branch
uses: dawidd6/action-delete-branch@v2.0.1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branches: integration-test-delete-beta

View File

@ -7,7 +7,7 @@ on:
- '*.*'
branches:
- dev
- releases/v3
- releases/v4
jobs:
# Deploys using checkout@v1 with an ACCESS_TOKEN.
@ -18,14 +18,14 @@ jobs:
uses: actions/checkout@v1
- name: Build and Deploy
uses: JamesIves/github-pages-deploy-action@releases/v3
uses: JamesIves/github-pages-deploy-action@releases/v4
with:
ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }}
BRANCH: gh-pages
FOLDER: integration
TARGET_FOLDER: cat/montezuma
GIT_CONFIG_NAME: Montezuma
GIT_CONFIG_EMAIL: montezuma@jamesiv.es
token: ${{ secrets.ACCESS_TOKEN }}
branch: gh-pages
folder: integration
target_folder: cat/montezuma
git_config_name: Montezuma
git_config_email: montezuma@jamesiv.es
- name: Cleanup Generated Branch
uses: dawidd6/action-delete-branch@v2.0.1
@ -44,12 +44,11 @@ jobs:
persist-credentials: false
- name: Build and Deploy
uses: JamesIves/github-pages-deploy-action@releases/v3
uses: JamesIves/github-pages-deploy-action@releases/v4
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BRANCH: gh-pages
FOLDER: integration
TARGET_FOLDER: cat/montezuma2
branch: gh-pages
folder: integration
target_folder: cat/montezuma2
- name: Cleanup Generated Branch
uses: dawidd6/action-delete-branch@v2.0.1
@ -77,12 +76,11 @@ jobs:
apt-get update && apt-get install -y rsync
- name: Build and Deploy
uses: JamesIves/github-pages-deploy-action@releases/v3
uses: JamesIves/github-pages-deploy-action@releases/v4
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BRANCH: gh-pages
FOLDER: integration
TARGET_FOLDER: cat/montezuma2
branch: gh-pages
folder: integration
target_folder: cat/montezuma2
- name: Cleanup Generated Branch
uses: dawidd6/action-delete-branch@v2.0.1
@ -106,12 +104,12 @@ jobs:
ssh-private-key: ${{ secrets.DEPLOY_KEY }}
- name: Build and Deploy
uses: JamesIves/github-pages-deploy-action@releases/v3
uses: JamesIves/github-pages-deploy-action@releases/v4
with:
SSH: true
BRANCH: gh-pages
FOLDER: integration
TARGET_FOLDER: cat/montezuma3
ssh: true
branch: gh-pages
folder: integration
target_folder: cat/montezuma3
- name: Cleanup Generated Branch
uses: dawidd6/action-delete-branch@v2.0.1
@ -139,12 +137,12 @@ jobs:
ssh-private-key: ${{ secrets.DEPLOY_KEY }}
- name: Build and Deploy
uses: JamesIves/github-pages-deploy-action@releases/v3
uses: JamesIves/github-pages-deploy-action@releases/v4
with:
SSH: true
BRANCH: gh-pages
FOLDER: integration
TARGET_FOLDER: cat/montezuma4
ssh: true
branch: gh-pages
folder: integration
target_folder: cat/montezuma4
- name: Cleanup Generated Branch
uses: dawidd6/action-delete-branch@v2.0.1
@ -163,12 +161,12 @@ jobs:
persist-credentials: false
- name: Build and Deploy
uses: JamesIves/github-pages-deploy-action@releases/v3
uses: JamesIves/github-pages-deploy-action@releases/v4
with:
ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }}
BRANCH: gh-pages
FOLDER: integration
CLEAN: true
token: ${{ secrets.ACCESS_TOKEN }}
branch: gh-pages
folder: integration
clean: true
# Deploys to a branch that doesn't exist with SINGLE_COMMIT.
integration-branch-creation:
@ -181,12 +179,12 @@ jobs:
persist-credentials: false
- name: Build and Deploy
uses: JamesIves/github-pages-deploy-action@releases/v3
uses: JamesIves/github-pages-deploy-action@releases/v4
with:
ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }}
BRANCH: integration-test-delete-prod
FOLDER: integration
SINGLE_COMMIT: true
token: ${{ secrets.ACCESS_TOKEN }}
branch: integration-test-delete-prod
folder: integration
single_commit: true
- name: Cleanup Generated Branch
uses: dawidd6/action-delete-branch@v2.0.1

View File

@ -64,8 +64,8 @@ jobs:
- name: Deploy 🚀
uses: JamesIves/github-pages-deploy-action@3.7.1
with:
BRANCH: gh-pages # The branch the action should deploy to.
FOLDER: build # The folder the action should deploy.
branch: gh-pages # The branch the action should deploy to.
folder: build # The folder the action should deploy.
```
If you'd like to make it so the workflow only triggers on push events to specific branches then you can modify the `on` section.
@ -124,37 +124,37 @@ 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** |
| `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 most customization you can modify the deployment type using the following options.
| Key | Value Information | Type | Required |
| -------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------- | -------- |
| `TOKEN` | This option defaults to the repository scoped GitHub Token. However if you need more permissions for things such as deploying to another repository, you can add a Personal Access Token (PAT) here. This should be stored in the `secrets / with` menu **as a secret**. We reccomend using a service account with the least permissions neccersary and recommend when generating a new PAT that you select the least permission scopes neccersary. [Learn more about creating and using encrypted secrets here.](https://help.github.com/en/actions/automating-your-workflow-with-github-actions/creating-and-using-encrypted-secrets) | **No** |
| `SSH` | You can configure the action to deploy using SSH by setting this option to `true`. For more information on how to add your ssh key pair please refer to the [Using a Deploy Key section of this README](https://github.com/JamesIves/github-pages-deploy-action/tree/dev#using-an-ssh-deploy-key-). | `with` | **No** |
| `token` | This option defaults to the repository scoped GitHub Token. However if you need more permissions for things such as deploying to another repository, you can add a Personal Access Token (PAT) here. This should be stored in the `secrets / with` menu **as a secret**. We reccomend using a service account with the least permissions neccersary and recommend when generating a new PAT that you select the least permission scopes neccersary. [Learn more about creating and using encrypted secrets here.](https://help.github.com/en/actions/automating-your-workflow-with-github-actions/creating-and-using-encrypted-secrets) | **No** |
| `ssh` | You can configure the action to deploy using SSH by setting this option to `true`. For more information on how to add your ssh key pair please refer to the [Using a Deploy Key section of this README](https://github.com/JamesIves/github-pages-deploy-action/tree/dev#using-an-ssh-deploy-key-). | `with` | **No** |
#### Optional Choices
| Key | Value Information | Type | Required |
| ------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------ | -------- |
| `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. | `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** |
| `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** |
| `COMMIT_MESSAGE` | If you need to customize the commit message for an integration you can do so. | `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 is turned on by default, and can be toggled off by setting it to `false`. | `with` | **No** |
| `CLEAN_EXCLUDE` | If you need to use `CLEAN` but you'd like to preserve certain files or folders you can use this option. This should be formatted as an array but stored as a string. For example: `'["filename.js", "folder"]'` | `with` | **No** |
| `DRY_RUN` | Do not actually push back, but use `--dry-run` on `git push` invocations insead. | `with` | **No** |
| `SINGLE_COMMIT` | This option can be toggled to `true` if you'd prefer to have a single commit on the deployment branch instead of maintaining the full history. **Using this option will also cause any existing history to be wiped from the deployment branch**. | `with` | **No** |
| `SILENT` | Silences the action output preventing it from displaying git messages. | `with` | **No** |
| `WORKSPACE` | This should point to where your project lives on the virtual machine. The GitHub Actions environment will set this for you. It is only necessary to set this variable if you're using the node module. | `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. | `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** |
| `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** |
| `commit_message` | If you need to customize the commit message for an integration you can do so. | `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 is turned on by default, and can be toggled off by setting it to `false`. | `with` | **No** |
| `clean_exclude` | If you need to use `clean` but you'd like to preserve certain files or folders you can use this option. This should be formatted as an array but stored as a string. For example: `'["filename.js", "folder"]'` | `with` | **No** |
| `dry_run` | Do not actually push back, but use `--dry-run` on `git push` invocations insead. | `with` | **No** |
| `single_commit` | This option can be toggled to `true` if you'd prefer to have a single commit on the deployment branch instead of maintaining the full history. **Using this option will also cause any existing history to be wiped from the deployment branch**. | `with` | **No** |
| `silent` | Silences the action output preventing it from displaying git messages. | `with` | **No** |
| `workspace` | This should point to where your project lives on the virtual machine. The GitHub Actions environment will set this for you. It is only necessary to set this variable if you're using the node module. | `with` | **No** |
With the action correctly configured you should see the workflow trigger the deployment under the configured conditions.
#### Deployment Status
The action will export an environment variable called `DEPLOYMENT_STATUS` that you can use in your workflow to determine if the deployment was successful or not. You can find an explanation of each status type below.
The action will export an environment variable called `deployment_status` that you can use in your workflow to determine if the deployment was successful or not. You can find an explanation of each status type below.
| Status | Description |
| ------------- |-------------|
@ -174,7 +174,7 @@ ssh-keygen -t rsa -m pem -b 4096 -C "youremailhere@example.com" -N ""
Once you've generated the key pair you must add the contents of the public key within your repository's [deploy keys menu](https://developer.github.com/v3/guides/managing-deploy-keys/). You can find this option by going to `Settings > Deploy Keys`, you can name the public key whatever you want, but you **do** need to give it write access. Afterwards add the contents of the private key to the `Settings > Secrets` menu as `DEPLOY_KEY`.
With this configured you must add the `ssh-agent` step to your workflow and set `SSH` to `true` within the deploy action. There are several SSH actions available on the [GitHub marketplace](https://github.com/marketplace?type=actions) for you to choose from.
With this configured you must add the `ssh-agent` step to your workflow and set `ssh` to `true` within the deploy action. There are several SSH actions available on the [GitHub marketplace](https://github.com/marketplace?type=actions) for you to choose from.
```yml
- name: Install SSH Client 🔑
@ -185,9 +185,9 @@ With this configured you must add the `ssh-agent` step to your workflow and set
- name: Deploy 🚀
uses: JamesIves/github-pages-deploy-action@3.7.1
with:
SSH: true
BRANCH: gh-pages
FOLDER: site
ssh: true
branch: gh-pages
folder: site
```
<details><summary>You can view a full example of this here.</summary>
@ -221,10 +221,10 @@ jobs:
- name: Deploy 🚀
uses: JamesIves/github-pages-deploy-action@3.7.1
with:
BRANCH: gh-pages
FOLDER: build
CLEAN: true
SSH: true # SSH must be set to true so the deploy action knows which protocol to deploy with.
branch: gh-pages
folder: build
clean: true
ssh: true # SSH must be set to true so the deploy action knows which protocol to deploy with.
```
</p>
@ -287,9 +287,9 @@ jobs:
- name: Deploy 🚀
uses: JamesIves/github-pages-deploy-action@3.7.1
with:
ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }}
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.
token: ${{ secrets.ACCESS_TOKEN }}
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.
```
</p>

View File

@ -74,47 +74,47 @@ export interface NodeActionInterface {
/* Required action data that gets initialized when running within the GitHub Actions environment. */
export const action: ActionInterface = {
folder: getInput('FOLDER'),
branch: getInput('BRANCH'),
commitMessage: getInput('COMMIT_MESSAGE'),
dryRun: !isNullOrUndefined(getInput('DRY_RUN'))
? getInput('DRY_RUN').toLowerCase() === 'true'
folder: getInput('folder'),
branch: getInput('branch'),
commitMessage: getInput('commit_message'),
dryRun: !isNullOrUndefined(getInput('dry_run'))
? getInput('dry_run').toLowerCase() === 'true'
: false,
clean: !isNullOrUndefined(getInput('CLEAN'))
? getInput('CLEAN').toLowerCase() === 'true'
clean: !isNullOrUndefined(getInput('clean'))
? getInput('clean').toLowerCase() === 'true'
: false,
cleanExclude: getInput('CLEAN_EXCLUDE'),
cleanExclude: getInput('clean_exclude'),
isTest: TestFlag.NONE,
email: !isNullOrUndefined(getInput('GIT_CONFIG_EMAIL'))
? getInput('GIT_CONFIG_EMAIL')
email: !isNullOrUndefined(getInput('git_config_email'))
? getInput('git_config_email')
: pusher && pusher.email
? pusher.email
: `${
process.env.GITHUB_ACTOR || 'github-pages-deploy-action'
}@users.noreply.github.com`,
name: !isNullOrUndefined(getInput('GIT_CONFIG_NAME'))
? getInput('GIT_CONFIG_NAME')
name: !isNullOrUndefined(getInput('git_config_name'))
? getInput('git_config_name')
: pusher && pusher.name
? pusher.name
: process.env.GITHUB_ACTOR
? process.env.GITHUB_ACTOR
: 'GitHub Pages Deploy Action',
repositoryName: !isNullOrUndefined(getInput('REPOSITORY_NAME'))
? getInput('REPOSITORY_NAME')
repositoryName: !isNullOrUndefined(getInput('repository_name'))
? getInput('repository_name')
: repository && repository.full_name
? repository.full_name
: process.env.GITHUB_REPOSITORY,
token: getInput('TOKEN'),
singleCommit: !isNullOrUndefined(getInput('SINGLE_COMMIT'))
? getInput('SINGLE_COMMIT').toLowerCase() === 'true'
token: getInput('token'),
singleCommit: !isNullOrUndefined(getInput('single_commit'))
? getInput('single_commit').toLowerCase() === 'true'
: false,
silent: !isNullOrUndefined(getInput('SILENT'))
? getInput('SILENT').toLowerCase() === 'true'
silent: !isNullOrUndefined(getInput('silent'))
? getInput('silent').toLowerCase() === 'true'
: false,
ssh: !isNullOrUndefined(getInput('SSH'))
? getInput('SSH').toLowerCase() === 'true'
ssh: !isNullOrUndefined(getInput('ssh'))
? getInput('ssh').toLowerCase() === 'true'
: false,
targetFolder: getInput('TARGET_FOLDER'),
targetFolder: getInput('target_folder'),
workspace: process.env.GITHUB_WORKSPACE || ''
}

View File

@ -59,6 +59,6 @@ export default async function run(
}`
)
exportVariable('DEPLOYMENT_STATUS', status)
exportVariable('deployment_status', status)
}
}