mirror of
https://github.com/JamesIves/github-pages-deploy-action.git
synced 2023-12-15 20:03:39 +08:00
Init 🚀
This commit is contained in:
parent
87b6ac3d90
commit
420901d6f8
27
.github/ISSUE_TEMPLATE/BUG_REPORT.md
vendored
Normal file
27
.github/ISSUE_TEMPLATE/BUG_REPORT.md
vendored
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
---
|
||||||
|
name: Bug Report
|
||||||
|
about: Create a bug report to help us improve the action.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
**Describe the bug**
|
||||||
|
|
||||||
|
> Please provide a clear and concise description of what the bug is.
|
||||||
|
|
||||||
|
**Reproduce**
|
||||||
|
|
||||||
|
> Steps to reproduce the behavior.
|
||||||
|
|
||||||
|
|
||||||
|
**Expected behavior**
|
||||||
|
|
||||||
|
> Please provide a clear and concise description of what you expected to happen.
|
||||||
|
|
||||||
|
**Screenshots**
|
||||||
|
|
||||||
|
> If applicable, add screenshots to help explain your problem.
|
||||||
|
|
||||||
|
|
||||||
|
**Additional Comments**
|
||||||
|
|
||||||
|
> Add any other context about the problem here.
|
17
.github/ISSUE_TEMPLATE/FEATURE_REQUEST.md
vendored
Normal file
17
.github/ISSUE_TEMPLATE/FEATURE_REQUEST.md
vendored
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
---
|
||||||
|
name: Feature Request
|
||||||
|
about: If you'd like to make a suggestion please fill out the form below.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
**Is your feature request related to a problem? Please describe.**
|
||||||
|
|
||||||
|
> Please provide a clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
|
||||||
|
|
||||||
|
**Describe the solution you'd like**
|
||||||
|
|
||||||
|
> Please provide a clear and concise description of what you want to happen.
|
||||||
|
|
||||||
|
**Additional Comments**
|
||||||
|
|
||||||
|
> Add any other context or screenshots about the feature request here.
|
8
.github/PULL_REQUEST_TEMPLATE.md
vendored
Normal file
8
.github/PULL_REQUEST_TEMPLATE.md
vendored
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
**Description**
|
||||||
|
> Provide a description of what your changes do.
|
||||||
|
|
||||||
|
**Testing Instructions**
|
||||||
|
> Give us step by step instructions on how to test your changes.
|
||||||
|
|
||||||
|
**Additional Notes**
|
||||||
|
> Anything else that will help us test the pull request.
|
13
Dockerfile
Normal file
13
Dockerfile
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
FROM node:10
|
||||||
|
|
||||||
|
LABEL "com.github.actions.name"="Deploy to Github Pages"
|
||||||
|
LABEL "com.github.actions.description"="Runs an optional build command and then pushes the branch to gh-pages."
|
||||||
|
LABEL "com.github.actions.icon"="github"
|
||||||
|
LABEL "com.github.actions.color"="#192022"
|
||||||
|
|
||||||
|
LABEL "repository"="http://github.com/JamesIves/gh-pages-github-action"
|
||||||
|
LABEL "homepage"="http://github.com/JamesIves/gh-pages-gh-action"
|
||||||
|
LABEL "maintainer"="James Ives <iam@jamesiv.es>"
|
||||||
|
|
||||||
|
ADD entrypoint.sh /entrypoint.sh
|
||||||
|
ENTRYPOINT ["/entrypoint.sh"]
|
39
README.md
Normal file
39
README.md
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
# Github Pages Deploy Action :github:
|
||||||
|
|
||||||
|
This Github action will handle the building and deploying process of your project to Github pages. It can be configured to upload your production ready code into any branch you'd like, including `gh-pages` and `docs`.
|
||||||
|
|
||||||
|
## Getting Started :airplane:
|
||||||
|
Before you get started you must first create a fresh branch where the action will deploy the files to.
|
||||||
|
|
||||||
|
```git
|
||||||
|
git checkout --orphan gh-pages
|
||||||
|
git push origin
|
||||||
|
```
|
||||||
|
|
||||||
|
Once setup you can then include the script in your workflow to trigger on any built in event that Github supports.
|
||||||
|
|
||||||
|
```
|
||||||
|
action "Deploy to gh-pages" {
|
||||||
|
uses = "./action"
|
||||||
|
env = {
|
||||||
|
BUILD_SCRIPT = "npm install && npm run-script build"
|
||||||
|
BRANCH = "gh-pages"
|
||||||
|
FOLDER = "build"
|
||||||
|
COMMIT_EMAIL = "iam@jamesiv.es"
|
||||||
|
COMMIT_NAME = "James Ives"
|
||||||
|
}
|
||||||
|
secrets = ["GITHUB_TOKEN"]
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
## Configuration 📁
|
||||||
|
|
||||||
|
The `env` portion of the workflow must be configured before the action will work. Below you'll find a description of each one does.
|
||||||
|
|
||||||
|
| Key | Value Information | Required |
|
||||||
|
| ------------- | ------------- | ------------- |
|
||||||
|
| `BUILD_SCRIPT` | If you require a build script to compile your code prior to pushing it you can add the script here. The Docker container which powers the action runs Node. | **No** |
|
||||||
|
| `BRANCH` | This is the branch you wish to deploy to, for example `gh-pages` or `docs`. | **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 in here. | **Yes** |
|
||||||
|
| `COMMIT_NAME` | Used to sign the commit, this should be your name. | **No** |
|
||||||
|
| `COMMIT_EMAIL` | Used to sign the commit, this should be your email. | **No** |
|
34
entrypoint.sh
Normal file
34
entrypoint.sh
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
#!/bin/sh -l
|
||||||
|
if [ -z "$BRANCH" ]
|
||||||
|
then
|
||||||
|
echo "Which branch should this push to?"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -z "$FOLDER" ]
|
||||||
|
then
|
||||||
|
echo "Which folder should this push to?"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Installs Git.
|
||||||
|
apt-get update && \
|
||||||
|
apt-get install -y git && \
|
||||||
|
|
||||||
|
# Re-directs to the the Github workspace.
|
||||||
|
cd $GITHUB_WORKSPACE && \
|
||||||
|
|
||||||
|
# Configures Git and checks out the base branch.
|
||||||
|
git config --global user.email "${COMMIT_EMAIL:-gh-pages-deploy@jives.dev}" && \
|
||||||
|
git config --global user.name "${COMMIT_NAME:-Github Pages Deploy}" && \
|
||||||
|
git checkout master && \
|
||||||
|
git push $GITHUB_REPOSITORY $BRANCH:$BRANCH
|
||||||
|
|
||||||
|
# Builds the project.
|
||||||
|
npm install && \
|
||||||
|
npm run-script build && \
|
||||||
|
|
||||||
|
# Commits the data to Github.
|
||||||
|
git add -f $FOLDER &&
|
||||||
|
git commit -m "Deploying $(date +"%T")" && \
|
||||||
|
git push origin `git subtree split --prefix $FOLDER master`:$BRANCH --force
|
||||||
|
|
Loading…
Reference in New Issue
Block a user