mirror of
https://github.com/JamesIves/github-pages-deploy-action.git
synced 2023-12-15 20:03:39 +08:00
Merge branch 'dev' into releases/v3
This commit is contained in:
commit
ce9af1d28d
52
.github/workflows/integration-beta.yml
vendored
52
.github/workflows/integration-beta.yml
vendored
@ -1,7 +1,7 @@
|
||||
name: integration-tests-beta
|
||||
on:
|
||||
schedule:
|
||||
- cron: 10 15 * * 0-6
|
||||
- cron: 30 15 * * 0-6
|
||||
push:
|
||||
branches:
|
||||
- dev
|
||||
@ -19,13 +19,20 @@ jobs:
|
||||
uses: JamesIves/github-pages-deploy-action@releases/v3-test
|
||||
with:
|
||||
ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }}
|
||||
BRANCH: gh-pages-beta
|
||||
BRANCH: gh-pages-test
|
||||
FOLDER: integration
|
||||
BASE_BRANCH: dev
|
||||
TARGET_FOLDER: 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
|
||||
@ -40,11 +47,17 @@ jobs:
|
||||
uses: JamesIves/github-pages-deploy-action@releases/v3-test
|
||||
with:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
BRANCH: gh-pages-beta
|
||||
BRANCH: gh-pages-test
|
||||
FOLDER: integration
|
||||
BASE_BRANCH: dev
|
||||
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.
|
||||
integration-container:
|
||||
@ -68,11 +81,18 @@ jobs:
|
||||
uses: JamesIves/github-pages-deploy-action@releases/v3-test
|
||||
with:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
BRANCH: gh-pages-beta
|
||||
BRANCH: gh-pages-test
|
||||
FOLDER: integration
|
||||
BASE_BRANCH: dev
|
||||
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.
|
||||
integration-ssh:
|
||||
needs: integration-container
|
||||
@ -92,11 +112,18 @@ jobs:
|
||||
uses: JamesIves/github-pages-deploy-action@releases/v3-test
|
||||
with:
|
||||
SSH: true
|
||||
BRANCH: gh-pages-beta
|
||||
BRANCH: gh-pages-test
|
||||
FOLDER: integration
|
||||
BASE_BRANCH: dev
|
||||
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.
|
||||
integration-env:
|
||||
needs: integration-ssh
|
||||
@ -120,12 +147,19 @@ jobs:
|
||||
uses: JamesIves/github-pages-deploy-action@releases/v3-test
|
||||
with:
|
||||
SSH: true
|
||||
BRANCH: gh-pages-beta
|
||||
BRANCH: gh-pages-test
|
||||
FOLDER: integration
|
||||
BASE_BRANCH: dev
|
||||
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:
|
||||
needs: [integration-checkout-v1, integration-checkout-v2, integration-container, integration-ssh, integration-env]
|
||||
runs-on: ubuntu-latest
|
||||
@ -139,11 +173,10 @@ jobs:
|
||||
uses: JamesIves/github-pages-deploy-action@releases/v3-test
|
||||
with:
|
||||
ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }}
|
||||
BRANCH: gh-pages-beta
|
||||
BRANCH: gh-pages-test
|
||||
FOLDER: integration
|
||||
BASE_BRANCH: dev
|
||||
CLEAN: true
|
||||
SINGLE_COMMIT: true
|
||||
|
||||
# Deploys to a branch that doesn't exist with SINGLE_COMMIT.
|
||||
integration-branch-creation:
|
||||
@ -161,7 +194,6 @@ jobs:
|
||||
BRANCH: integration-test-delete-beta
|
||||
FOLDER: integration
|
||||
BASE_BRANCH: dev
|
||||
CLEAN: true
|
||||
SINGLE_COMMIT: true
|
||||
|
||||
- name: Cleanup Generated Branch
|
||||
|
40
.github/workflows/integration.yml
vendored
40
.github/workflows/integration.yml
vendored
@ -1,7 +1,7 @@
|
||||
name: integration-tests
|
||||
on:
|
||||
schedule:
|
||||
- cron: 10 15 * * 0-6
|
||||
- cron: 30 15 * * 0-6
|
||||
push:
|
||||
tags-ignore:
|
||||
- '*.*'
|
||||
@ -28,6 +28,12 @@ jobs:
|
||||
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
|
||||
|
||||
# Deploys using checkout@v2 with a GITHUB_TOKEN.
|
||||
integration-checkout-v2:
|
||||
needs: integration-checkout-v1
|
||||
@ -47,6 +53,12 @@ jobs:
|
||||
BASE_BRANCH: dev
|
||||
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.
|
||||
integration-container:
|
||||
@ -75,6 +87,12 @@ jobs:
|
||||
BASE_BRANCH: dev
|
||||
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.
|
||||
integration-ssh:
|
||||
needs: integration-container
|
||||
@ -94,11 +112,17 @@ jobs:
|
||||
uses: JamesIves/github-pages-deploy-action@releases/v3
|
||||
with:
|
||||
SSH: true
|
||||
BRANCH: gh-pages-beta
|
||||
BRANCH: gh-pages
|
||||
FOLDER: integration
|
||||
BASE_BRANCH: dev
|
||||
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.
|
||||
integration-env:
|
||||
needs: integration-ssh
|
||||
@ -122,12 +146,18 @@ jobs:
|
||||
uses: JamesIves/github-pages-deploy-action@releases/v3
|
||||
with:
|
||||
SSH: true
|
||||
BRANCH: gh-pages-beta
|
||||
BRANCH: gh-pages
|
||||
FOLDER: integration
|
||||
BASE_BRANCH: dev
|
||||
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:
|
||||
needs: [integration-checkout-v1, integration-checkout-v2, integration-container, integration-ssh, integration-env]
|
||||
runs-on: ubuntu-latest
|
||||
@ -145,7 +175,6 @@ jobs:
|
||||
FOLDER: integration
|
||||
BASE_BRANCH: dev
|
||||
CLEAN: true
|
||||
SINGLE_COMMIT: true
|
||||
|
||||
# Deploys to a branch that doesn't exist with SINGLE_COMMIT.
|
||||
integration-branch-creation:
|
||||
@ -163,7 +192,6 @@ jobs:
|
||||
BRANCH: integration-test-delete-prod
|
||||
FOLDER: integration
|
||||
BASE_BRANCH: dev
|
||||
CLEAN: true
|
||||
SINGLE_COMMIT: true
|
||||
|
||||
- name: Cleanup Generated Branch
|
||||
|
21
.github/workflows/publish.yml
vendored
21
.github/workflows/publish.yml
vendored
@ -7,27 +7,38 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- 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
|
||||
run: |
|
||||
git config user.email "iam@jamesiv.es"
|
||||
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 run-script build
|
||||
- run: npm version patch -m "Release %s 📣"
|
||||
- run: git push
|
||||
- run: npm ci
|
||||
|
||||
# Publish to npm
|
||||
- run: npm publish --access public
|
||||
env:
|
||||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
||||
|
||||
# Setup .npmrc file to publish to GitHub Packages
|
||||
- uses: actions/setup-node@v1
|
||||
with:
|
||||
node-version: 12
|
||||
registry-url: 'https://npm.pkg.github.com'
|
||||
scope: '@JamesIves'
|
||||
|
||||
# Publish to GitHub Packages
|
||||
- run: npm publish
|
||||
env:
|
||||
|
@ -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`.
|
||||
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.
|
||||
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
|
||||
|
||||
|
@ -316,7 +316,7 @@ describe('git', () => {
|
||||
await deploy(action)
|
||||
|
||||
// Includes the call to generateBranch
|
||||
expect(execute).toBeCalledTimes(12)
|
||||
expect(execute).toBeCalledTimes(13)
|
||||
})
|
||||
|
||||
it('should execute commands with single commit toggled', async () => {
|
||||
@ -334,7 +334,7 @@ describe('git', () => {
|
||||
await deploy(action)
|
||||
|
||||
// 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 () => {
|
||||
@ -354,7 +354,7 @@ describe('git', () => {
|
||||
await deploy(action)
|
||||
|
||||
// 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 () => {
|
||||
@ -373,7 +373,7 @@ describe('git', () => {
|
||||
await deploy(action)
|
||||
|
||||
// Includes the call to generateBranch
|
||||
expect(execute).toBeCalledTimes(12)
|
||||
expect(execute).toBeCalledTimes(13)
|
||||
})
|
||||
|
||||
it('should gracefully handle incorrectly formatted clean exclude items', async () => {
|
||||
@ -391,7 +391,7 @@ describe('git', () => {
|
||||
|
||||
await deploy(action)
|
||||
|
||||
expect(execute).toBeCalledTimes(12)
|
||||
expect(execute).toBeCalledTimes(13)
|
||||
})
|
||||
|
||||
it('should stop early if there is nothing to commit', async () => {
|
||||
@ -407,7 +407,7 @@ describe('git', () => {
|
||||
})
|
||||
|
||||
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 () => {
|
||||
@ -427,7 +427,7 @@ describe('git', () => {
|
||||
try {
|
||||
await deploy(action)
|
||||
} catch (e) {
|
||||
expect(execute).toBeCalledTimes(1)
|
||||
expect(execute).toBeCalledTimes(2)
|
||||
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. ❌'
|
||||
)
|
||||
|
@ -42,7 +42,7 @@ describe('main', () => {
|
||||
debug: true
|
||||
})
|
||||
await run(action)
|
||||
expect(execute).toBeCalledTimes(19)
|
||||
expect(execute).toBeCalledTimes(20)
|
||||
})
|
||||
|
||||
it('should throw if an error is encountered', async () => {
|
||||
|
17
package.json
17
package.json
@ -1,8 +1,8 @@
|
||||
{
|
||||
"name": "github-pages-deploy-action",
|
||||
"description": "GitHub action for building a project and deploying it to GitHub pages.",
|
||||
"author": "James Ives <iam@jamesiv.es>",
|
||||
"version": "3.4.5",
|
||||
"author": "James Ives <iam@jamesiv.es> (https://jamesiv.es)",
|
||||
"version": "3.4.6",
|
||||
"license": "MIT",
|
||||
"main": "lib/lib.js",
|
||||
"types": "lib/lib.d.ts",
|
||||
@ -38,15 +38,16 @@
|
||||
"@actions/github": "2.1.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/jest": "25.1.4",
|
||||
"@types/node": "13.9.8",
|
||||
"jest": "25.2.4",
|
||||
"jest-circus": "25.2.4",
|
||||
"prettier": "2.0.2",
|
||||
"ts-jest": "25.3.0",
|
||||
"@types/jest": "25.2.1",
|
||||
"@types/node": "13.11.1",
|
||||
"eslint": "6.8.0",
|
||||
"eslint-plugin-github": "3.4.1",
|
||||
"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"
|
||||
}
|
||||
}
|
||||
|
14
src/git.ts
14
src/git.ts
@ -100,11 +100,11 @@ export async function deploy(action: ActionInterface): Promise<void> {
|
||||
try {
|
||||
hasRequiredParameters(action)
|
||||
|
||||
const commitMessage = `${
|
||||
!isNullOrUndefined(action.commitMessage)
|
||||
? action.commitMessage
|
||||
: `Deploying to ${action.branch} from ${action.baseBranch}`
|
||||
} ${process.env.GITHUB_SHA ? `@ ${process.env.GITHUB_SHA}` : ''} 🚀`
|
||||
const commitMessage = !isNullOrUndefined(action.commitMessage)
|
||||
? (action.commitMessage as string)
|
||||
: `Deploying to ${action.branch} from ${action.baseBranch} ${
|
||||
process.env.GITHUB_SHA ? `@ ${process.env.GITHUB_SHA}` : ''
|
||||
} 🚀`
|
||||
|
||||
/*
|
||||
Checks to see if the remote exists prior to deploying.
|
||||
@ -239,6 +239,10 @@ export async function deploy(action: ActionInterface): Promise<void> {
|
||||
)
|
||||
} finally {
|
||||
// Ensures the deployment directory is safely removed.
|
||||
await execute(
|
||||
`chmod u+w -R ${temporaryDeploymentDirectory}`,
|
||||
action.workspace
|
||||
)
|
||||
await execute(`rm -rf ${temporaryDeploymentDirectory}`, action.workspace)
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user