Merge branch 'dev' into releases/v3

This commit is contained in:
JamesIves 2020-04-09 11:01:05 -04:00
commit ce9af1d28d
9 changed files with 536 additions and 405 deletions

View File

@ -1,7 +1,7 @@
name: integration-tests-beta name: integration-tests-beta
on: on:
schedule: schedule:
- cron: 10 15 * * 0-6 - cron: 30 15 * * 0-6
push: push:
branches: branches:
- dev - dev
@ -19,13 +19,20 @@ jobs:
uses: JamesIves/github-pages-deploy-action@releases/v3-test uses: JamesIves/github-pages-deploy-action@releases/v3-test
with: with:
ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }} ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }}
BRANCH: gh-pages-beta BRANCH: gh-pages-test
FOLDER: integration FOLDER: integration
BASE_BRANCH: dev BASE_BRANCH: dev
TARGET_FOLDER: montezuma TARGET_FOLDER: montezuma
GIT_CONFIG_NAME: Montezuma GIT_CONFIG_NAME: Montezuma
GIT_CONFIG_EMAIL: montezuma@jamesiv.es 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. # Deploys using checkout@v2 with a GITHUB_TOKEN.
integration-checkout-v2: integration-checkout-v2:
needs: integration-checkout-v1 needs: integration-checkout-v1
@ -40,11 +47,17 @@ jobs:
uses: JamesIves/github-pages-deploy-action@releases/v3-test uses: JamesIves/github-pages-deploy-action@releases/v3-test
with: with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BRANCH: gh-pages-beta BRANCH: gh-pages-test
FOLDER: integration FOLDER: integration
BASE_BRANCH: dev BASE_BRANCH: dev
TARGET_FOLDER: montezuma2 TARGET_FOLDER: 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. # Deploys using a container that requires you to install rsync.
integration-container: integration-container:
@ -68,11 +81,18 @@ jobs:
uses: JamesIves/github-pages-deploy-action@releases/v3-test uses: JamesIves/github-pages-deploy-action@releases/v3-test
with: with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BRANCH: gh-pages-beta BRANCH: gh-pages-test
FOLDER: integration FOLDER: integration
BASE_BRANCH: dev BASE_BRANCH: dev
TARGET_FOLDER: montezuma2 TARGET_FOLDER: 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. # Deploys using an SSH key.
integration-ssh: integration-ssh:
needs: integration-container needs: integration-container
@ -92,11 +112,18 @@ jobs:
uses: JamesIves/github-pages-deploy-action@releases/v3-test uses: JamesIves/github-pages-deploy-action@releases/v3-test
with: with:
SSH: true SSH: true
BRANCH: gh-pages-beta BRANCH: gh-pages-test
FOLDER: integration FOLDER: integration
BASE_BRANCH: dev BASE_BRANCH: dev
TARGET_FOLDER: montezuma3 TARGET_FOLDER: 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. # Deploys using a custom env.
integration-env: integration-env:
needs: integration-ssh needs: integration-ssh
@ -120,12 +147,19 @@ jobs:
uses: JamesIves/github-pages-deploy-action@releases/v3-test uses: JamesIves/github-pages-deploy-action@releases/v3-test
with: with:
SSH: true SSH: true
BRANCH: gh-pages-beta BRANCH: gh-pages-test
FOLDER: integration FOLDER: integration
BASE_BRANCH: dev BASE_BRANCH: dev
TARGET_FOLDER: montezuma4 TARGET_FOLDER: montezuma4
# Deploys using the CLEAN option with SINGLE_COMMIT toggled. - 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: integration-clean:
needs: [integration-checkout-v1, integration-checkout-v2, integration-container, integration-ssh, integration-env] needs: [integration-checkout-v1, integration-checkout-v2, integration-container, integration-ssh, integration-env]
runs-on: ubuntu-latest runs-on: ubuntu-latest
@ -139,11 +173,10 @@ jobs:
uses: JamesIves/github-pages-deploy-action@releases/v3-test uses: JamesIves/github-pages-deploy-action@releases/v3-test
with: with:
ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }} ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }}
BRANCH: gh-pages-beta BRANCH: gh-pages-test
FOLDER: integration FOLDER: integration
BASE_BRANCH: dev BASE_BRANCH: dev
CLEAN: true CLEAN: true
SINGLE_COMMIT: true
# Deploys to a branch that doesn't exist with SINGLE_COMMIT. # Deploys to a branch that doesn't exist with SINGLE_COMMIT.
integration-branch-creation: integration-branch-creation:
@ -161,7 +194,6 @@ jobs:
BRANCH: integration-test-delete-beta BRANCH: integration-test-delete-beta
FOLDER: integration FOLDER: integration
BASE_BRANCH: dev BASE_BRANCH: dev
CLEAN: true
SINGLE_COMMIT: true SINGLE_COMMIT: true
- name: Cleanup Generated Branch - name: Cleanup Generated Branch

View File

@ -1,7 +1,7 @@
name: integration-tests name: integration-tests
on: on:
schedule: schedule:
- cron: 10 15 * * 0-6 - cron: 30 15 * * 0-6
push: push:
tags-ignore: tags-ignore:
- '*.*' - '*.*'
@ -28,6 +28,12 @@ jobs:
GIT_CONFIG_NAME: Montezuma GIT_CONFIG_NAME: Montezuma
GIT_CONFIG_EMAIL: montezuma@jamesiv.es 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
# Deploys using checkout@v2 with a GITHUB_TOKEN. # Deploys using checkout@v2 with a GITHUB_TOKEN.
integration-checkout-v2: integration-checkout-v2:
needs: integration-checkout-v1 needs: integration-checkout-v1
@ -47,6 +53,12 @@ jobs:
BASE_BRANCH: dev BASE_BRANCH: dev
TARGET_FOLDER: montezuma2 TARGET_FOLDER: montezuma2
- name: Cleanup Generated Branch
uses: dawidd6/action-delete-branch@v2.0.1
with:
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:
@ -75,6 +87,12 @@ jobs:
BASE_BRANCH: dev BASE_BRANCH: dev
TARGET_FOLDER: montezuma2 TARGET_FOLDER: montezuma2
- name: Cleanup Generated Branch
uses: dawidd6/action-delete-branch@v2.0.1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branches: gh-pages
# Deploys using an SSH key. # Deploys using an SSH key.
integration-ssh: integration-ssh:
needs: integration-container needs: integration-container
@ -94,11 +112,17 @@ jobs:
uses: JamesIves/github-pages-deploy-action@releases/v3 uses: JamesIves/github-pages-deploy-action@releases/v3
with: with:
SSH: true SSH: true
BRANCH: gh-pages-beta BRANCH: gh-pages
FOLDER: integration FOLDER: integration
BASE_BRANCH: dev BASE_BRANCH: dev
TARGET_FOLDER: montezuma3 TARGET_FOLDER: montezuma3
- name: Cleanup Generated Branch
uses: dawidd6/action-delete-branch@v2.0.1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branches: gh-pages
# Deploys using a custom env. # Deploys using a custom env.
integration-env: integration-env:
needs: integration-ssh needs: integration-ssh
@ -122,12 +146,18 @@ jobs:
uses: JamesIves/github-pages-deploy-action@releases/v3 uses: JamesIves/github-pages-deploy-action@releases/v3
with: with:
SSH: true SSH: true
BRANCH: gh-pages-beta BRANCH: gh-pages
FOLDER: integration FOLDER: integration
BASE_BRANCH: dev BASE_BRANCH: dev
TARGET_FOLDER: montezuma4 TARGET_FOLDER: montezuma4
# Deploys using the CLEAN option with SINGLE_COMMIT toggled. - name: Cleanup Generated Branch
uses: dawidd6/action-delete-branch@v2.0.1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branches: gh-pages
# Deploys using the CLEAN option.
integration-clean: integration-clean:
needs: [integration-checkout-v1, integration-checkout-v2, integration-container, integration-ssh, integration-env] needs: [integration-checkout-v1, integration-checkout-v2, integration-container, integration-ssh, integration-env]
runs-on: ubuntu-latest runs-on: ubuntu-latest
@ -145,7 +175,6 @@ jobs:
FOLDER: integration FOLDER: integration
BASE_BRANCH: dev BASE_BRANCH: dev
CLEAN: true CLEAN: true
SINGLE_COMMIT: true
# Deploys to a branch that doesn't exist with SINGLE_COMMIT. # Deploys to a branch that doesn't exist with SINGLE_COMMIT.
integration-branch-creation: integration-branch-creation:
@ -163,7 +192,6 @@ jobs:
BRANCH: integration-test-delete-prod BRANCH: integration-test-delete-prod
FOLDER: integration FOLDER: integration
BASE_BRANCH: dev BASE_BRANCH: dev
CLEAN: true
SINGLE_COMMIT: true SINGLE_COMMIT: true
- name: Cleanup Generated Branch - name: Cleanup Generated Branch

View File

@ -7,27 +7,38 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
with:
ref: dev
# Setup .npmrc file to publish to npm
- uses: actions/setup-node@v1
with:
node-version: 12
registry-url: 'https://registry.npmjs.org'
- name: Configure git - name: Configure git
run: | run: |
git config user.email "iam@jamesiv.es" git config user.email "iam@jamesiv.es"
git config user.name "James Ives" git config user.name "James Ives"
# Setup .npmrc file to publish to npm
- uses: actions/setup-node@v1
with:
node-version: '10.x'
registry-url: 'https://registry.npmjs.org'
- run: npm install - run: npm install
- run: npm run-script build - run: npm run-script build
- run: npm version patch -m "Release %s 📣"
- run: git push
- run: npm ci - run: npm ci
# Publish to npm # Publish to npm
- run: npm publish --access public - run: npm publish --access public
env: env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
# Setup .npmrc file to publish to GitHub Packages # Setup .npmrc file to publish to GitHub Packages
- uses: actions/setup-node@v1 - uses: actions/setup-node@v1
with: with:
node-version: 12
registry-url: 'https://npm.pkg.github.com' registry-url: 'https://npm.pkg.github.com'
scope: '@JamesIves' scope: '@JamesIves'
# Publish to GitHub Packages # Publish to GitHub Packages
- run: npm publish - run: npm publish
env: env:

View File

@ -8,6 +8,8 @@ email, or any other method with the owners of this repository before making a ch
1. Ensure that you've tested your feature/change yourself. As the primary focus of this project is deployment, providing a link to a deployed repository using your branch is preferred. You can reference the forked action using your GitHub username, for example `yourname/github-pages-deplpy-action@master`. 1. Ensure that you've tested your feature/change yourself. As the primary focus of this project is deployment, providing a link to a deployed repository using your branch is preferred. You can reference the forked action using your GitHub username, for example `yourname/github-pages-deplpy-action@master`.
2. Make sure you update the README if you've made a change that requires documentation. 2. Make sure you update the README if you've made a change that requires documentation.
3. 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. 3. 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.
4. Make sure you've formatted and linted your code. You can do this by running `yarn format` and `yarn lint`.
5. Fix or add any tests where applicable. You can run `yarn test` to run the suite.
# Deploying # Deploying

View File

@ -316,7 +316,7 @@ describe('git', () => {
await deploy(action) await deploy(action)
// Includes the call to generateBranch // Includes the call to generateBranch
expect(execute).toBeCalledTimes(12) expect(execute).toBeCalledTimes(13)
}) })
it('should execute commands with single commit toggled', async () => { it('should execute commands with single commit toggled', async () => {
@ -334,7 +334,7 @@ describe('git', () => {
await deploy(action) await deploy(action)
// Includes the call to generateBranch // Includes the call to generateBranch
expect(execute).toBeCalledTimes(18) expect(execute).toBeCalledTimes(19)
}) })
it('should execute commands with clean options, ommits sha commit message', async () => { it('should execute commands with clean options, ommits sha commit message', async () => {
@ -354,7 +354,7 @@ describe('git', () => {
await deploy(action) await deploy(action)
// Includes the call to generateBranch // Includes the call to generateBranch
expect(execute).toBeCalledTimes(12) expect(execute).toBeCalledTimes(13)
}) })
it('should execute commands with clean options stored as an array instead', async () => { it('should execute commands with clean options stored as an array instead', async () => {
@ -373,7 +373,7 @@ describe('git', () => {
await deploy(action) await deploy(action)
// Includes the call to generateBranch // Includes the call to generateBranch
expect(execute).toBeCalledTimes(12) expect(execute).toBeCalledTimes(13)
}) })
it('should gracefully handle incorrectly formatted clean exclude items', async () => { it('should gracefully handle incorrectly formatted clean exclude items', async () => {
@ -391,7 +391,7 @@ describe('git', () => {
await deploy(action) await deploy(action)
expect(execute).toBeCalledTimes(12) expect(execute).toBeCalledTimes(13)
}) })
it('should stop early if there is nothing to commit', async () => { it('should stop early if there is nothing to commit', async () => {
@ -407,7 +407,7 @@ describe('git', () => {
}) })
await deploy(action) await deploy(action)
expect(execute).toBeCalledTimes(13) expect(execute).toBeCalledTimes(14)
}) })
it('should throw an error if one of the required parameters is not available', async () => { it('should throw an error if one of the required parameters is not available', async () => {
@ -427,7 +427,7 @@ describe('git', () => {
try { try {
await deploy(action) await deploy(action)
} catch (e) { } catch (e) {
expect(execute).toBeCalledTimes(1) expect(execute).toBeCalledTimes(2)
expect(e.message).toMatch( expect(e.message).toMatch(
'The deploy step encountered an error: No deployment token/method was provided. You must provide the action with either a Personal Access Token or the GitHub Token secret in order to deploy. If you wish to use an ssh deploy token then you must set SSH to true. ❌' 'The deploy step encountered an error: No deployment token/method was provided. You must provide the action with either a Personal Access Token or the GitHub Token secret in order to deploy. If you wish to use an ssh deploy token then you must set SSH to true. ❌'
) )

View File

@ -42,7 +42,7 @@ describe('main', () => {
debug: true debug: true
}) })
await run(action) await run(action)
expect(execute).toBeCalledTimes(19) expect(execute).toBeCalledTimes(20)
}) })
it('should throw if an error is encountered', async () => { it('should throw if an error is encountered', async () => {

View File

@ -1,8 +1,8 @@
{ {
"name": "github-pages-deploy-action", "name": "github-pages-deploy-action",
"description": "GitHub action for building a project and deploying it to GitHub pages.", "description": "GitHub action for building a project and deploying it to GitHub pages.",
"author": "James Ives <iam@jamesiv.es>", "author": "James Ives <iam@jamesiv.es> (https://jamesiv.es)",
"version": "3.4.5", "version": "3.4.6",
"license": "MIT", "license": "MIT",
"main": "lib/lib.js", "main": "lib/lib.js",
"types": "lib/lib.d.ts", "types": "lib/lib.d.ts",
@ -38,15 +38,16 @@
"@actions/github": "2.1.1" "@actions/github": "2.1.1"
}, },
"devDependencies": { "devDependencies": {
"@types/jest": "25.1.4", "@types/jest": "25.2.1",
"@types/node": "13.9.8", "@types/node": "13.11.1",
"jest": "25.2.4",
"jest-circus": "25.2.4",
"prettier": "2.0.2",
"ts-jest": "25.3.0",
"eslint": "6.8.0", "eslint": "6.8.0",
"eslint-plugin-github": "3.4.1", "eslint-plugin-github": "3.4.1",
"eslint-plugin-jest": "23.8.2", "eslint-plugin-jest": "23.8.2",
"eslint-plugin-prettier": "^3.1.2",
"jest": "25.3.0",
"jest-circus": "25.3.0",
"prettier": "2.0.4",
"ts-jest": "25.3.1",
"typescript": "3.8.3" "typescript": "3.8.3"
} }
} }

View File

@ -100,11 +100,11 @@ export async function deploy(action: ActionInterface): Promise<void> {
try { try {
hasRequiredParameters(action) hasRequiredParameters(action)
const commitMessage = `${ const commitMessage = !isNullOrUndefined(action.commitMessage)
!isNullOrUndefined(action.commitMessage) ? (action.commitMessage as string)
? action.commitMessage : `Deploying to ${action.branch} from ${action.baseBranch} ${
: `Deploying to ${action.branch} from ${action.baseBranch}` process.env.GITHUB_SHA ? `@ ${process.env.GITHUB_SHA}` : ''
} ${process.env.GITHUB_SHA ? `@ ${process.env.GITHUB_SHA}` : ''} 🚀` } 🚀`
/* /*
Checks to see if the remote exists prior to deploying. Checks to see if the remote exists prior to deploying.
@ -239,6 +239,10 @@ export async function deploy(action: ActionInterface): Promise<void> {
) )
} finally { } finally {
// Ensures the deployment directory is safely removed. // Ensures the deployment directory is safely removed.
await execute(
`chmod u+w -R ${temporaryDeploymentDirectory}`,
action.workspace
)
await execute(`rm -rf ${temporaryDeploymentDirectory}`, action.workspace) await execute(`rm -rf ${temporaryDeploymentDirectory}`, action.workspace)
} }
} }

779
yarn.lock

File diff suppressed because it is too large Load Diff