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
d2f2f7fe9b
23
.github/workflows/publish.yml
vendored
23
.github/workflows/publish.yml
vendored
@ -2,6 +2,7 @@ name: publish-to-npm
|
||||
on:
|
||||
release:
|
||||
types: [created]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
@ -11,21 +12,24 @@ jobs:
|
||||
ref: dev
|
||||
|
||||
# Setup .npmrc file to publish to npm
|
||||
- uses: actions/setup-node@v1
|
||||
- uses: actions/setup-node@v1.4.2
|
||||
with:
|
||||
node-version: 12
|
||||
node-version: '10.15.1'
|
||||
registry-url: 'https://registry.npmjs.org'
|
||||
scope: '@jamesives'
|
||||
|
||||
- name: Configure git
|
||||
run: |
|
||||
git config user.email "iam@jamesiv.es"
|
||||
git config user.name "James Ives"
|
||||
|
||||
- run: npm install
|
||||
- run: npm run-script build
|
||||
- name: Install Yarn
|
||||
run: npm install -g yarn
|
||||
|
||||
- run: yarn install --frozen-lockfile
|
||||
- run: yarn build
|
||||
- run: npm version patch -m "Release %s 📣"
|
||||
- run: git push
|
||||
- run: npm ci
|
||||
|
||||
# Publish to npm
|
||||
- run: npm publish --access public
|
||||
@ -33,11 +37,16 @@ jobs:
|
||||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
||||
|
||||
# Setup .npmrc file to publish to GitHub Packages
|
||||
- uses: actions/setup-node@v1
|
||||
- uses: actions/setup-node@v1.4.2
|
||||
with:
|
||||
node-version: 12
|
||||
registry-url: 'https://npm.pkg.github.com'
|
||||
scope: '@JamesIves'
|
||||
scope: '@jamesives'
|
||||
|
||||
- name: Authenticate with the GitHub Package Registry
|
||||
run:
|
||||
echo "//npm.pkg.github.com:_authToken=${{ secrets.GITHUB_TOKEN }}" >
|
||||
~/.npmrc
|
||||
|
||||
# Publish to GitHub Packages
|
||||
- run: npm publish
|
||||
|
@ -1,18 +1,19 @@
|
||||
# Contributing
|
||||
# Contributing ✏️
|
||||
|
||||
When contributing to this repository, please first discuss the change you wish to make via issue,
|
||||
email, or any other method with the owners of this repository before making a change.
|
||||
[email, or any other method with the owners of this repository](https://jamesiv.es) before making a change.
|
||||
|
||||
## Before Making a Pull Request
|
||||
## Before Making a Pull Request 🎒
|
||||
|
||||
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. 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.
|
||||
6. Ensure all typing is accurate and the action compiles correctly by running `yarn build`.
|
||||
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. 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`.
|
||||
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`.
|
||||
|
||||
# Deploying
|
||||
## Deploying 🚚
|
||||
|
||||
In order to deploy and test your own fork of this action, you must commit the `node_modules` dependencies. Be sure to run `nvm use` before installing any dependencies. You can learn more about nvm [here](https://github.com/nvm-sh/nvm/blob/master/README.md).
|
||||
|
||||
@ -43,4 +44,10 @@ $ git checkout -b branchnamehere
|
||||
$ git commit -a -m "prod dependencies"
|
||||
```
|
||||
|
||||
The `node_modules` folder should _not_ be included when making a pull request. These are only required for GitHub Actions when it consumes the distribution branch, the `dev` branch of the project should be free from any dependencies or lib files.
|
||||
The `node_modules` folder should _not_ be included when making a pull request. These are only required for GitHub Actions when it consumes the distribution branch, the `dev` branch of the project should be free from any dependencies or lib files.
|
||||
|
||||
## Resources 💡
|
||||
|
||||
* [TypeScript](https://www.typescriptlang.org/)
|
||||
* [Jest](https://jestjs.io/)
|
||||
* [GitHub Actions Documentation](https://help.github.com/en/actions)
|
||||
|
14
README.md
14
README.md
@ -1,6 +1,6 @@
|
||||
<p align="center">
|
||||
<a href="https://github.com/marketplace/actions/deploy-to-github-pages">
|
||||
<img width="150px" src="./assets/icon.png">
|
||||
<img width="150px" src="https://github.com/JamesIves/github-pages-deploy-action/raw/dev/assets/icon.png">
|
||||
</a>
|
||||
</p>
|
||||
|
||||
@ -35,7 +35,7 @@
|
||||
</p>
|
||||
|
||||
<p align="center">
|
||||
<img src="./assets/screenshot.png">
|
||||
<img src="https://github.com/JamesIves/github-pages-deploy-action/raw/dev/assets/screenshot.png">
|
||||
</p>
|
||||
|
||||
## Getting Started :airplane:
|
||||
@ -83,7 +83,7 @@ on:
|
||||
If you'd like to use the functionality provided by this action in your own action you can install it using [yarn](https://yarnpkg.com/) by running the following command.
|
||||
|
||||
```
|
||||
yarn add github-pages-deploy-action
|
||||
yarn add @jamesives/github-pages-deploy-action
|
||||
```
|
||||
|
||||
It can then be imported into your project like so.
|
||||
@ -153,12 +153,12 @@ With the action correctly configured you should see the workflow trigger the dep
|
||||
|
||||
#### Deployment Status
|
||||
|
||||
The action will export an environment variable called `DEPLOYMENT_STATUS` that you can use in your workflow to determine if the deployment was successful or not. You can find an explanation of each status code below.
|
||||
The action will export an environment variable called `DEPLOYMENT_STATUS` that you can use in your workflow to determine if the deployment was successful or not. You can find an explanation of each status type below.
|
||||
|
||||
| Status | Description |
|
||||
| ------------- |:-------------:|
|
||||
| `success` | The `success` status indicates that the action was able to successfully deploy the project to the branch. |
|
||||
| `failed` | The `failed` status indicates that the action encountered an error while trying to deploy the project. |
|
||||
| ------------- |-------------|
|
||||
| `success` | The `success` status indicates that the action was able to successfully deploy to the branch. |
|
||||
| `failed` | The `failed` status indicates that the action encountered an error while trying to deploy. |
|
||||
| `skipped` | The `skipped` status indicates that the action exited early as there was nothing new to deploy. |
|
||||
|
||||
---
|
||||
|
@ -3,7 +3,7 @@ process.env['INPUT_FOLDER'] = 'build'
|
||||
process.env['GITHUB_SHA'] = '123'
|
||||
|
||||
import {mkdirP, rmRF} from '@actions/io'
|
||||
import {action} from '../src/constants'
|
||||
import {action, Status} from '../src/constants'
|
||||
import {execute} from '../src/execute'
|
||||
import {deploy, generateBranch, init, switchToBaseBranch} from '../src/git'
|
||||
|
||||
@ -338,11 +338,12 @@ describe('git', () => {
|
||||
}
|
||||
})
|
||||
|
||||
await deploy(action)
|
||||
const response = await deploy(action)
|
||||
|
||||
// Includes the call to generateBranch
|
||||
expect(execute).toBeCalledTimes(11)
|
||||
expect(rmRF).toBeCalledTimes(1)
|
||||
expect(response).toBe(Status.SUCCESS)
|
||||
})
|
||||
|
||||
it('should execute commands with single commit toggled', async () => {
|
||||
@ -437,9 +438,10 @@ describe('git', () => {
|
||||
isTest: false // Setting this env variable to false means there will never be anything to commit and the action will exit early.
|
||||
})
|
||||
|
||||
await deploy(action)
|
||||
const response = await deploy(action)
|
||||
expect(execute).toBeCalledTimes(12)
|
||||
expect(rmRF).toBeCalledTimes(1)
|
||||
expect(response).toBe(Status.SKIPPED)
|
||||
})
|
||||
|
||||
it('should throw an error if one of the required parameters is not available', async () => {
|
||||
|
@ -1,8 +1,8 @@
|
||||
{
|
||||
"name": "github-pages-deploy-action",
|
||||
"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": "3.4.9",
|
||||
"version": "3.5.1",
|
||||
"license": "MIT",
|
||||
"main": "lib/lib.js",
|
||||
"types": "lib/lib.d.ts",
|
||||
|
@ -30,7 +30,6 @@ export default async function run(
|
||||
status = Status.FAILED
|
||||
setFailed(error.message)
|
||||
} finally {
|
||||
console.log(status)
|
||||
info(
|
||||
`${
|
||||
status === Status.FAILED
|
||||
|
Loading…
Reference in New Issue
Block a user