diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d98c4845..51137cf7 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -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 diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 7ba12c12..9940382c 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -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 diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 32e67c3b..daa2363e 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -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: . diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml index ce698619..59a44dd0 100644 --- a/.github/workflows/integration.yml +++ b/.github/workflows/integration.yml @@ -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 diff --git a/.github/workflows/sponsors.yml b/.github/workflows/sponsors.yml index 1e3ad244..ae6f9566 100644 --- a/.github/workflows/sponsors.yml +++ b/.github/workflows/sponsors.yml @@ -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: '{{{ login }}}  ' 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: '{{{ login }}}  ' 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: '.' diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 00000000..1b07c39e --- /dev/null +++ b/.prettierignore @@ -0,0 +1,3 @@ +# Ignore artifacts: +build +coverage \ No newline at end of file diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 756e1b52..c5f7e131 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -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`. diff --git a/README.md b/README.md index 2ffc6478..d5b19ce9 100644 --- a/README.md +++ b/README.md @@ -43,11 +43,11 @@

- +github  

-Chooksta69  milanpollock  robjtede   +Chooksta69  robjtede  hadley  kevinchalet  Yousazoe  

## 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: | diff --git a/action.yml b/action.yml index 8f761b37..f508021d 100644 --- a/action.yml +++ b/action.yml @@ -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.' diff --git a/integration/index.html b/integration/index.html index 024fc79a..d427f0c9 100644 --- a/integration/index.html +++ b/integration/index.html @@ -1,12 +1,13 @@ - + Integration Test