Merge branch 'dev' into releases/v4

This commit is contained in:
James Ives 2022-06-26 09:01:19 -04:00
commit 95ad738c59
15 changed files with 291 additions and 404 deletions

View File

@ -27,7 +27,8 @@ jobs:
- name: Install and Test
run: |
yarn install --frozen-lockfile
yarn lint
yarn lint:check
yarn lint:format:check
yarn test
- name: Uploade CodeCov Report

View File

@ -22,10 +22,10 @@ jobs:
uses: actions/checkout@v3
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
uses: github/codeql-action/init@v2
- name: Autobuild
uses: github/codeql-action/autobuild@v1
uses: github/codeql-action/autobuild@v2
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
uses: github/codeql-action/analyze@v2

View File

@ -13,7 +13,7 @@ jobs:
# Workflow dispatch event that pushes the current version to the release branch.
# From here the secondary production deployment workflow will trigger to build the dependencies.
- name: Deploy 🚀
uses: JamesIves/github-pages-deploy-action@v4.3.2
uses: JamesIves/github-pages-deploy-action@v4
with:
branch: releases/v4
folder: .

View File

@ -28,13 +28,12 @@ jobs:
uses: actions/checkout@v3
- name: Build and Deploy
uses: JamesIves/github-pages-deploy-action@v4.3.2
uses: JamesIves/github-pages-deploy-action@v4
with:
git-config-name: Montezuma
git-config-email: montezuma@jamesiv.es
repository-name: MontezumaIves/lab
token: ${{ secrets.ACCESS_TOKEN }}
branch: gh-pages
folder: integration
single-commit: true
clean: true
@ -49,10 +48,9 @@ jobs:
uses: actions/checkout@v3
- name: Build and Deploy
uses: JamesIves/github-pages-deploy-action@v4.3.2
uses: JamesIves/github-pages-deploy-action@v4
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:
@ -76,9 +73,8 @@ jobs:
persist-credentials: false
- name: Build and Deploy
uses: JamesIves/github-pages-deploy-action@v4.3.2
uses: JamesIves/github-pages-deploy-action@v4
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:
@ -108,9 +103,8 @@ jobs:
apt-get update && apt-get install -y rsync
- name: Build and Deploy
uses: JamesIves/github-pages-deploy-action@v4.3.2
uses: JamesIves/github-pages-deploy-action@v4
with:
branch: gh-pages
folder: integration
target-folder: cat/montezuma2
silent: true
@ -132,10 +126,9 @@ jobs:
persist-credentials: false
- name: Build and Deploy
uses: JamesIves/github-pages-deploy-action@v4.3.2
uses: JamesIves/github-pages-deploy-action@v4
with:
ssh-key: ${{ secrets.DEPLOY_KEY }}
branch: gh-pages
folder: integration
target-folder: cat/montezuma3
silent: true
@ -162,10 +155,9 @@ jobs:
ssh-private-key: ${{ secrets.DEPLOY_KEY }}
- name: Build and Deploy
uses: JamesIves/github-pages-deploy-action@v4.3.2
uses: JamesIves/github-pages-deploy-action@v4
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:
@ -191,19 +182,17 @@ jobs:
persist-credentials: false
- name: Build and Deploy
uses: JamesIves/github-pages-deploy-action@v4.3.2
uses: JamesIves/github-pages-deploy-action@v4
with:
ssh-key: ${{ secrets.DEPLOY_KEY }}
branch: gh-pages
folder: integration
target-folder: cat/montezuma4
silent: true
- name: Build and Deploy
uses: JamesIves/github-pages-deploy-action@v4.3.2
uses: JamesIves/github-pages-deploy-action@v4
with:
ssh-key: ${{ secrets.DEPLOY_KEY }}
branch: gh-pages
folder: integration
target-folder: cat/subsequent
silent: true
@ -233,10 +222,9 @@ jobs:
persist-credentials: false
- name: Build and Deploy
uses: JamesIves/github-pages-deploy-action@v4.3.2
uses: JamesIves/github-pages-deploy-action@v4
with:
token: ${{ secrets.ACCESS_TOKEN }}
branch: gh-pages
folder: integration
clean: true
silent: true
@ -252,7 +240,7 @@ jobs:
persist-credentials: false
- name: Build and Deploy
uses: JamesIves/github-pages-deploy-action@v4.3.2
uses: JamesIves/github-pages-deploy-action@v4
with:
token: ${{ secrets.ACCESS_TOKEN }}
branch: integration-test-delete-prod
@ -261,7 +249,7 @@ jobs:
silent: true
- name: Build and Deploy
uses: JamesIves/github-pages-deploy-action@v4.3.2
uses: JamesIves/github-pages-deploy-action@v4
with:
token: ${{ secrets.ACCESS_TOKEN }}
branch: integration-test-delete-prod
@ -289,7 +277,7 @@ jobs:
run: echo $RANDOM > integration/1
- name: Build and Deploy
uses: JamesIves/github-pages-deploy-action@v4.3.2
uses: JamesIves/github-pages-deploy-action@v4
with:
git-config-name: Montezuma
git-config-email: montezuma@jamesiv.es
@ -311,7 +299,7 @@ jobs:
run: echo $RANDOM > integration/2
- name: Build and Deploy
uses: JamesIves/github-pages-deploy-action@v4.3.2
uses: JamesIves/github-pages-deploy-action@v4
with:
git-config-name: Montezuma
git-config-email: montezuma@jamesiv.es

View File

@ -12,24 +12,26 @@ jobs:
uses: actions/checkout@v3
- name: Generate Sponsors 💖
uses: JamesIves/github-sponsors-readme-action@v1.0.8
uses: JamesIves/github-sponsors-readme-action@v1
with:
token: ${{ secrets.PAT }}
file: 'README.md'
template: '<a href="https://github.com/{{{ login }}}"><img src="https://github.com/{{{ login }}}.png" width="50px" alt="{{{ login }}}" /></a>&nbsp;&nbsp;'
maximum: 9999
organization: true
- name: Generate Sponsors 💖
uses: JamesIves/github-sponsors-readme-action@v1.0.8
uses: JamesIves/github-sponsors-readme-action@v1
with:
token: ${{ secrets.PAT }}
file: 'README.md'
minimum: 10000
template: '<a href="https://github.com/{{{ login }}}"><img src="https://github.com/{{{ login }}}.png" width="80px" alt="{{{ login }}}" /></a>&nbsp;&nbsp;'
marker: 'premium'
organization: true
- name: Deploy to GitHub Pages
uses: JamesIves/github-pages-deploy-action@v4.3.2
uses: JamesIves/github-pages-deploy-action@v4
with:
branch: dev
folder: '.'

3
.prettierignore Normal file
View File

@ -0,0 +1,3 @@
# Ignore artifacts:
build
coverage

View File

@ -9,7 +9,7 @@ When contributing to this repository, please first discuss the change you wish t
2. Ensure your change passes all of the integration tests.
3. Make sure you update the README if you've made a change that requires documentation.
4. When making a pull request, highlight any areas that may cause a breaking change so the maintainer can update the version number accordingly on the GitHub marketplace and package registries.
5. Make sure you've formatted and linted your code. You can do this by running `yarn format` and `yarn lint`.
5. Make sure you've linted and formatted your code. You can do this by running `yarn lint` and `yarn lint:format`.
6. Fix or add any tests where applicable. You can run `yarn test` to run the suite. As this action is small in scope it's important that a high level of test coverage is maintained. All tests are written using [Jest](https://jestjs.io/).
7. As this package is written in [TypeScript](https://www.typescriptlang.org/) please ensure all typing is accurate and the action compiles correctly by running `yarn build`.

View File

@ -43,11 +43,11 @@
</p>
<p align="center">
<!-- premium --><!-- premium -->
<!-- premium --><a href="https://github.com/github"><img src="https://github.com/github.png" width="80px" alt="github" /></a>&nbsp;&nbsp;<!-- premium -->
</p>
<p align="center">
<!-- sponsors --><a href="https://github.com/Chooksta69"><img src="https://github.com/Chooksta69.png" width="50px" alt="Chooksta69" /></a>&nbsp;&nbsp;<a href="https://github.com/milanpollock"><img src="https://github.com/milanpollock.png" width="50px" alt="milanpollock" /></a>&nbsp;&nbsp;<a href="https://github.com/robjtede"><img src="https://github.com/robjtede.png" width="50px" alt="robjtede" /></a>&nbsp;&nbsp;<!-- sponsors -->
<!-- sponsors --><a href="https://github.com/Chooksta69"><img src="https://github.com/Chooksta69.png" width="50px" alt="Chooksta69" /></a>&nbsp;&nbsp;<a href="https://github.com/robjtede"><img src="https://github.com/robjtede.png" width="50px" alt="robjtede" /></a>&nbsp;&nbsp;<a href="https://github.com/hadley"><img src="https://github.com/hadley.png" width="50px" alt="hadley" /></a>&nbsp;&nbsp;<a href="https://github.com/kevinchalet"><img src="https://github.com/kevinchalet.png" width="50px" alt="kevinchalet" /></a>&nbsp;&nbsp;<a href="https://github.com/Yousazoe"><img src="https://github.com/Yousazoe.png" width="50px" alt="Yousazoe" /></a>&nbsp;&nbsp;<!-- sponsors -->
</p>
## Getting Started :airplane:
@ -59,6 +59,8 @@ You can view an example of this below.
```yml
name: Build and Deploy
on: [push]
permissions:
contents: write
jobs:
build-and-deploy:
concurrency: ci-${{ github.ref }} # Recommended if you intend to make multiple deployments in quick succession.
@ -73,9 +75,8 @@ jobs:
npm run build
- name: Deploy 🚀
uses: JamesIves/github-pages-deploy-action@v4.3.0
uses: JamesIves/github-pages-deploy-action@v4
with:
branch: gh-pages # The branch the action should deploy to.
folder: build # The folder the action should deploy.
```
@ -90,6 +91,15 @@ on:
It's recommended that you use [Dependabot](https://docs.github.com/en/code-security/supply-chain-security/keeping-your-dependencies-updated-automatically) to keep your workflow up-to-date and [secure](https://github.com/features/security). You can find the latest tagged version on the [GitHub Marketplace](https://github.com/marketplace/actions/deploy-to-github-pages) or on the [releases page](https://github.com/JamesIves/github-pages-deploy-action/releases).
#### Permission Settings ⚠️
If you do not supply the action with an access token or an SSH key, you must access your repositories settings and provide `Read and Write Permissions` to the provided `GITHUB_TOKEN`, otherwise you'll potentailly run into permission issues. Alternatively you can set the following in your workflow file to grant the action the permissions it needs.
```yml
permissions:
contents: write
```
#### Install as a Node Module 📦
If you'd like to use the functionality provided by this action in your own action you can either [create a composite action](https://docs.github.com/en/actions/creating-actions/creating-a-composite-action), or you can install it using [yarn](https://yarnpkg.com/) or [npm](https://www.npmjs.com/get-npm) by running the following commands. It's available on both the [npm](https://www.npmjs.com/package/@jamesives/github-pages-deploy-action) and [GitHub registry](https://github.com/JamesIves/github-pages-deploy-action/packages/229985).
@ -115,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,
@ -135,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.
@ -149,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`. Defaults to `gh-pages`. | `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** |
@ -192,9 +201,8 @@ With this configured, you can then set the `ssh-key` part of the action to your
```yml
- name: Deploy 🚀
uses: JamesIves/github-pages-deploy-action@v4.3.0
uses: JamesIves/github-pages-deploy-action@v4
with:
branch: gh-pages
folder: site
ssh-key: ${{ secrets.DEPLOY_KEY }}
```
@ -222,9 +230,8 @@ jobs:
npm run build
- name: Deploy 🚀
uses: JamesIves/github-pages-deploy-action@v4.3.0
uses: JamesIves/github-pages-deploy-action@v4
with:
branch: gh-pages
folder: build
clean: true
clean-exclude: |
@ -258,6 +265,8 @@ If you're using an operating system such as [Windows](https://www.microsoft.com/
```yml
name: Build and Deploy
on: [push]
permissions:
contents: write
jobs:
build:
runs-on: windows-latest # The first job utilizes windows-latest
@ -290,9 +299,8 @@ jobs:
name: site
- name: Deploy 🚀
uses: JamesIves/github-pages-deploy-action@v4.3.0
uses: JamesIves/github-pages-deploy-action@v4
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.
```
@ -311,7 +319,7 @@ If you use a [container](https://help.github.com/en/actions/automating-your-work
apt-get update && apt-get install -y rsync
- name: Deploy 🚀
uses: JamesIves/github-pages-deploy-action@v4.3.0
uses: JamesIves/github-pages-deploy-action@v4
```
---
@ -325,6 +333,8 @@ If you're using a custom domain and require a `CNAME` file, or if you require th
```yml
name: Build and Deploy
permissions:
contents: write
on:
push:
branches:
@ -343,9 +353,8 @@ jobs:
npm run build
- name: Deploy 🚀
uses: JamesIves/github-pages-deploy-action@v4.3.0
uses: JamesIves/github-pages-deploy-action@v4
with:
branch: gh-pages
folder: build
clean: true
clean-exclude: |

View File

@ -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.'

View File

@ -1,12 +1,13 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta charset="UTF-8" />
<title>Integration Test</title>
<meta name="robots" content="noindex" />
<style>
html, body {
html,
body {
height: 100%;
width: 100%;
}

View File

@ -2,15 +2,17 @@
"name": "@jamesives/github-pages-deploy-action",
"description": "GitHub action for building a project and deploying it to GitHub pages.",
"author": "James Ives <iam@jamesiv.es> (https://jamesiv.es)",
"version": "4.3.2",
"version": "4.3.3",
"license": "MIT",
"main": "lib/lib.js",
"types": "lib/lib.d.ts",
"scripts": {
"build": "rimraf lib && tsc --declaration",
"test": "jest",
"lint": "eslint src/**/*.ts __tests__/**/*.ts",
"lint:format": "prettier --write './**/*.{ts,js,json,yml,md}' './*.{ts,js,json,yml,md}'"
"lint": "eslint --fix .",
"lint:check": "eslint .",
"lint:format": "prettier --write .",
"lint:format:check": "prettier --check ."
},
"repository": {
"type": "git",
@ -33,25 +35,25 @@
"deployment"
],
"dependencies": {
"@actions/core": "1.6.0",
"@actions/core": "1.9.0",
"@actions/exec": "1.1.1",
"@actions/github": "5.0.1",
"@actions/github": "5.0.3",
"@actions/io": "1.1.2"
},
"devDependencies": {
"@types/jest": "27.4.1",
"@types/node": "17.0.26",
"@types/jest": "27.5.0",
"@types/node": "18.0.0",
"@typescript-eslint/eslint-plugin": "4.33.0",
"@typescript-eslint/parser": "4.33.0",
"eslint": "7.32.0",
"eslint-config-prettier": "8.5.0",
"eslint-plugin-jest": "26.1.5",
"eslint-plugin-jest": "26.5.3",
"eslint-plugin-prettier": "4.0.0",
"jest": "26.6.3",
"jest-circus": "27.5.1",
"prettier": "2.6.2",
"prettier": "2.7.1",
"rimraf": "3.0.2",
"ts-jest": "26.5.6",
"typescript": "4.6.3"
"typescript": "4.7.4"
}
}

View File

@ -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. */

View File

@ -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.

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.
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. */

547
yarn.lock

File diff suppressed because it is too large Load Diff