Skip to content

Commit

Permalink
Merge branch 'dev' into releases/v4
Browse files Browse the repository at this point in the history
  • Loading branch information
JamesIves committed Mar 4, 2021
2 parents 049a95c + 9119c52 commit 45f4c85
Show file tree
Hide file tree
Showing 20 changed files with 364 additions and 934 deletions.
18 changes: 0 additions & 18 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ on:
- 'dev-v*'
- 'releases/v*'
pull_request:
# The branches below must be a subset of the branches above
branches:
- dev
- 'dev-v*'
Expand All @@ -22,28 +21,11 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v2

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
# Override language selection by uncommenting this and choosing your languages
# with:
# languages: go, javascript, csharp, python, cpp, java

# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v1

# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl

# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
# and modify them (or add more) to build your code if your project
# uses a compiled language

#- run: |
# make bootstrap
# make release

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
21 changes: 21 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Deploy Code to Release Branch
on:
workflow_dispatch:

jobs:
build:
name: Push to Release Branch
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2

# 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@4.0.0
with:
branch: releases/v4
folder: .
clean: false
single-commit: true
20 changes: 17 additions & 3 deletions .github/workflows/integration.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
name: integration-tests
on:
workflow_dispatch:
inputs:
branch:
description: 'Specifies the branch which the integration tests should run on.'
required: true
default: 'releases/v4'
schedule:
- cron: 30 15 * * 0-6
push:
tags-ignore:
- '*.*'
branches:
- dev
- releases/v4

jobs:
Expand All @@ -22,12 +27,13 @@ jobs:
with:
git-config-name: Montezuma
git-config-email: montezuma@jamesiv.es
repository-name: JamesIves/lab
repository-name: MontezumaIves/lab
token: ${{ secrets.ACCESS_TOKEN }}
branch: gh-pages
folder: integration
single-commit: true
clean: true
silent: true

# Deploys using checkout@v1 with an ACCESS_TOKEN.
integration-checkout-v1:
Expand All @@ -46,6 +52,7 @@ jobs:
target-folder: cat/montezuma
git-config-name: Montezuma
git-config-email: montezuma@jamesiv.es
silent: true

- name: Cleanup Generated Branch
uses: dawidd6/action-delete-branch@v2.0.1
Expand All @@ -69,6 +76,7 @@ jobs:
branch: gh-pages
folder: integration
target-folder: cat/montezuma2
silent: true

- name: Cleanup Generated Branch
uses: dawidd6/action-delete-branch@v2.0.1
Expand Down Expand Up @@ -101,6 +109,7 @@ jobs:
branch: gh-pages
folder: integration
target-folder: cat/montezuma2
silent: true

- name: Cleanup Generated Branch
uses: dawidd6/action-delete-branch@v2.0.1
Expand All @@ -125,6 +134,7 @@ jobs:
branch: gh-pages
folder: integration
target-folder: cat/montezuma3
silent: true

- name: Cleanup Generated Branch
uses: dawidd6/action-delete-branch@v2.0.1
Expand All @@ -150,10 +160,11 @@ jobs:
- name: Build and Deploy
uses: JamesIves/github-pages-deploy-action@releases/v4
with:
ssh: true
ssh-key: true
branch: gh-pages
folder: integration
target-folder: cat/montezuma4
silent: true

- name: Cleanup Generated Branch
uses: dawidd6/action-delete-branch@v2.0.1
Expand Down Expand Up @@ -182,6 +193,7 @@ jobs:
branch: gh-pages
folder: integration
target-folder: cat/montezuma4
silent: true

- name: Cleanup Generated Branch
uses: dawidd6/action-delete-branch@v2.0.1
Expand All @@ -206,6 +218,7 @@ jobs:
branch: gh-pages
folder: integration
clean: true
silent: true

# Deploys to a branch that doesn't exist with SINGLE_COMMIT.
integration-branch-creation:
Expand All @@ -224,6 +237,7 @@ jobs:
branch: integration-test-delete-prod
folder: integration
single-commit: true
silent: true

- name: Cleanup Generated Branch
uses: dawidd6/action-delete-branch@v2.0.1
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/production.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:

jobs:
build:
name: Build production
name: Build Production
runs-on: ubuntu-latest
steps:
- name: Checkout
Expand Down
11 changes: 7 additions & 4 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
name: publish-to-npm
on:
release:
types: [created]
workflow_dispatch:
inputs:
version:
description: 'The updated registry version number.'
required: true

jobs:
build:
Expand All @@ -18,7 +21,7 @@ jobs:
registry-url: 'https://registry.npmjs.org'
scope: '@jamesives'

- name: Configure git
- name: Configure Git
run: |
git config user.email "iam@jamesiv.es"
git config user.name "James Ives"
Expand All @@ -28,7 +31,7 @@ jobs:

- run: yarn install --frozen-lockfile
- run: yarn build
# - run: npm version patch -m "Release %s 📣"
- run: npm version ${{ github.event.inputs.version }} -m "Release ${{ github.event.inputs.version }} 📣"
- run: git push

# Publish to npm
Expand Down
4 changes: 2 additions & 2 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2020 James Ives
Copyright (c) 2021 James Ives

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand All @@ -18,4 +18,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
SOFTWARE.
13 changes: 6 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
</p>

<p align="center">
This <a href="https://github.com/features/actions">GitHub Action</a> will automatically deploy your project to <a href="https://pages.github.com/">GitHub Pages</a>. It can be configured to push your production-ready code into any branch you'd like, including <b>gh-pages</b> and <b>docs</b>. It can also handle cross repository deployments too.
This <a href="https://github.com/features/actions">GitHub Action</a> will automatically deploy your project to <a href="https://pages.github.com/">GitHub Pages</a>. It can be configured to push your production-ready code into any branch you'd like, including <b>gh-pages</b> and <b>docs</b>. It can also handle cross repository deployments and works with <a href="https://github.com/enterprise">GitHub Enterprise</a> too.
</p>

<p align="center">
Expand Down Expand Up @@ -129,7 +129,7 @@ By default the action does not need any token configuration and uses the provide

| 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) | `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 recommend using a service account with the least permissions necessary and recommend when generating a new PAT that you select the least permission scopes necessary. [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) | `with` | **No** |
| `ssh-key` | You can configure the action to deploy using SSH by setting this option to a private SSH key stored **as a secret**. It can also be set to `true` to use an existing SSH client configuration. For more detailed information on how to add your public/private 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
Expand All @@ -143,7 +143,7 @@ By default the action does not need any token configuration and uses the provide
| `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 target folder on 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 contain each pattern as a single line in a multiline string. | `with` | **No** |
| `dry-run` | Do not actually push back, but use `--dry-run` on `git push` invocations insead. | `with` | **No** |
| `dry-run` | Do not actually push back, but use `--dry-run` on `git push` invocations instead. | `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** |
Expand Down Expand Up @@ -305,8 +305,7 @@ If you use a [container](https://help.github.com/en/actions/automating-your-work

If you're using a custom domain and require a `CNAME` file, or if you require the use of a `.nojekyll` file, you can safely commit these files directly into deployment branch without them being overridden after each deployment, additionally you can include these files in your deployment folder to update them. If you need to add additional files to the deployment that should be ignored by the build clean-up steps you can utilize the `clean-exclude` option.


<details><summary>Click here to view an exmaple of this.</summary>
<details><summary>Click here to view an example of this.</summary>
<p>

```yml
Expand Down Expand Up @@ -346,6 +345,6 @@ If you wish to remove these files you must go into the deployment branch directl

## Support 💖

This project would not be possible without all of our fantastic [contributors](https://github.com/JamesIves/github-pages-deploy-action/graphs/contributors). The project logo was created by [Paganini](https://twitter.com/paganiniart).
This project would not be possible without all of our fantastic [contributors](https://github.com/JamesIves/github-pages-deploy-action/graphs/contributors).

If you'd like to support the maintenance and upkeep of this project you can [donate via GitHub Sponsors](https://github.com/sponsors/JamesIves). This project is distributed under the [MIT](https://github.com/JamesIves/github-pages-deploy-action/blob/dev/LICENSE) license.
If you'd like to support the maintenance and upkeep of this project you can [donate via GitHub Sponsors](https://github.com/sponsors/JamesIves). This project is distributed under the [MIT](https://github.com/JamesIves/github-pages-deploy-action/blob/dev/LICENSE) license, and the project logo was created by [Paganini](https://twitter.com/paganiniart).
2 changes: 1 addition & 1 deletion SECURITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ The current version is actively maintained and will receive frequent updates and

## Reporting a Vulnerability

Please disclose any security vulnerabilities either through the issues interface (as a bug) or by [emailing the project maintainer](https://jamesiv.es).
Please disclose any security vulnerabilities either through the issues interface (as a bug) or by [emailing the project maintainer](https://jamesiv.es). Please bare in mind that this project is voluntarily maintained and updates will be worked on based on availability.
16 changes: 16 additions & 0 deletions __tests__/git.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ describe('git', () => {
describe('init', () => {
it('should execute commands', async () => {
Object.assign(action, {
hostname: 'github.com',
silent: false,
repositoryPath: 'JamesIves/github-pages-deploy-action',
token: '123',
Expand All @@ -64,6 +65,7 @@ describe('git', () => {
})

Object.assign(action, {
hostname: 'github.com',
silent: false,
repositoryPath: 'JamesIves/github-pages-deploy-action',
token: '123',
Expand All @@ -87,6 +89,7 @@ describe('git', () => {

it('should correctly continue when it cannot unset a git config value', async () => {
Object.assign(action, {
hostname: 'github.com',
silent: false,
repositoryPath: 'JamesIves/github-pages-deploy-action',
token: '123',
Expand All @@ -108,6 +111,7 @@ describe('git', () => {
process.env.CI = 'true'

Object.assign(action, {
hostname: 'github.com',
silent: false,
repositoryPath: 'JamesIves/github-pages-deploy-action',
sshKey: true,
Expand All @@ -128,6 +132,7 @@ describe('git', () => {

it('should correctly continue when it cannot remove origin', async () => {
Object.assign(action, {
hostname: 'github.com',
silent: false,
repositoryPath: 'JamesIves/github-pages-deploy-action',
token: '123',
Expand All @@ -148,6 +153,7 @@ describe('git', () => {
describe('deploy', () => {
it('should execute commands', async () => {
Object.assign(action, {
hostname: 'github.com',
silent: false,
folder: 'assets',
branch: 'branch',
Expand All @@ -170,6 +176,7 @@ describe('git', () => {

it('should not push when asked to dryRun', async () => {
Object.assign(action, {
hostname: 'github.com',
silent: false,
dryRun: true,
folder: 'assets',
Expand All @@ -192,6 +199,7 @@ describe('git', () => {

it('should execute commands with single commit toggled', async () => {
Object.assign(action, {
hostname: 'github.com',
silent: false,
folder: 'other',
folderPath: 'other',
Expand All @@ -215,6 +223,7 @@ describe('git', () => {

it('should execute commands with single commit toggled and existing branch', async () => {
Object.assign(action, {
hostname: 'github.com',
silent: false,
folder: 'other',
folderPath: 'other',
Expand All @@ -238,6 +247,7 @@ describe('git', () => {

it('should execute commands with single commit and dryRun toggled', async () => {
Object.assign(action, {
hostname: 'github.com',
silent: false,
folder: 'other',
folderPath: 'other',
Expand Down Expand Up @@ -270,6 +280,7 @@ describe('git', () => {
})

Object.assign(action, {
hostname: 'github.com',
silent: false,
folder: 'assets',
folderPath: 'assets',
Expand Down Expand Up @@ -300,6 +311,7 @@ describe('git', () => {
it('should execute commands with clean options', async () => {
process.env.GITHUB_SHA = ''
Object.assign(action, {
hostname: 'github.com',
silent: false,
folder: 'other',
folderPath: 'other',
Expand All @@ -324,6 +336,7 @@ describe('git', () => {

it('should execute commands with clean options stored as an array', async () => {
Object.assign(action, {
hostname: 'github.com',
silent: false,
folder: 'assets',
folderPath: 'assets',
Expand All @@ -347,6 +360,7 @@ describe('git', () => {

it('should gracefully handle target folder', async () => {
Object.assign(action, {
hostname: 'github.com',
silent: false,
folder: '.',
branch: 'branch',
Expand All @@ -367,6 +381,7 @@ describe('git', () => {

it('should stop early if there is nothing to commit', async () => {
Object.assign(action, {
hostname: 'github.com',
silent: false,
folder: 'assets',
branch: 'branch',
Expand All @@ -390,6 +405,7 @@ describe('git', () => {
})

Object.assign(action, {
hostname: 'github.com',
silent: false,
folder: 'assets',
branch: 'branch',
Expand Down
Loading

0 comments on commit 45f4c85

Please sign in to comment.