Skip to content

Commit 455daba

Browse files
authored
CICD Workflow Instructions (JamesIves#12)
* Upgrade Instructions * Update README.md * Changes * Update README.md
1 parent 561f843 commit 455daba

File tree

2 files changed

+49
-37
lines changed

2 files changed

+49
-37
lines changed

README.md

Lines changed: 49 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -4,49 +4,61 @@
44

55
This [GitHub action](https://github.com/features/actions) will handle the building and deploying process of your project to [GitHub Pages](https://pages.github.com/). It can be configured to upload your production ready code into any branch you'd like, including `gh-pages` and `docs`. This action is built on [Node](https://nodejs.org/en/), which means that you can call any optional build scripts your project requires prior to deploying.
66

7+
❗️**You can find instructions for using version 1 of the GitHub Actions workflow format [here](https://github.com/JamesIves/github-pages-deploy-action/tree/1.1.3).**
8+
79
## Getting Started :airplane:
8-
You can include the action in your workflow to trigger on any event that [GitHub actions](https://github.com/features/actions) supports. If the remote branch that you wish to deploy to doesn't already exist the action will create it for you.
9-
10-
```workflow
11-
action "Deploy to GitHub Pages" {
12-
uses = "JamesIves/github-pages-deploy-action@master"
13-
env = {
14-
BUILD_SCRIPT = "npm install && npm run-script build"
15-
BRANCH = "gh-pages"
16-
FOLDER = "build"
17-
}
18-
secrets = ["ACCESS_TOKEN"]
19-
}
10+
You can include the action in your workflow to trigger on any event that [GitHub actions](https://github.com/features/actions) supports. If the remote branch that you wish to deploy to doesn't already exist the action will create it for you.
11+
12+
Your workflow will also need to include the `actions/checkout` step before this workflow runs in order for the deployment to work. You can view an example of this below.
13+
14+
```yml
15+
name: Build and Deploy
16+
on: [push]
17+
jobs:
18+
build-and-deploy:
19+
runs-on: ubuntu-latest
20+
steps:
21+
- name: Checkout
22+
uses: actions/checkout@master
23+
24+
- name: Build and Deploy
25+
uses: JamesIves/github-pages-deploy-action@master
26+
env:
27+
ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }}
28+
BRANCH: gh-pages
29+
FOLDER: build
30+
BUILD_SCRIPT: npm install && npm run-script build
2031
```
2132
22-
If you'd like you can combine it with the filter action so it only triggers deploys on a specific branch. You can find an example of this below.
23-
24-
```workflow
25-
workflow "Deploy to Github Pages" {
26-
on = "push"
27-
resolves = ["Deploy to gh-pages"]
28-
}
29-
30-
action "master branch only" {
31-
uses = "actions/bin/filter@master"
32-
args = "branch master"
33-
}
34-
35-
action "Deploy to gh-pages" {
36-
uses = "JamesIves/github-pages-deploy-action@master"
37-
env = {
38-
BRANCH = "gh-pages"
39-
BUILD_SCRIPT = "npm install && npm run-script build"
40-
FOLDER = "build"
41-
}
42-
secrets = ["ACCESS_TOKEN"]
43-
needs = ["master branch only"]
44-
}
33+
You can combine it with the filter action so it only triggers deploys on a specific branch.
34+
35+
```yml
36+
name: Build and Deploy
37+
on:
38+
push:
39+
branches:
40+
- master
41+
jobs:
42+
build-and-deploy:
43+
runs-on: ubuntu-latest
44+
steps:
45+
- name: Checkout
46+
uses: actions/checkout@master
47+
48+
- name: Build and Deploy
49+
uses: JamesIves/github-pages-deploy-action@master
50+
env:
51+
ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }}
52+
BRANCH: gh-pages
53+
FOLDER: build
54+
BUILD_SCRIPT: npm install && npm run-script build
4555
```
4656
4757
## Configuration 📁
4858
49-
The `secrets` and `env` portion of the workflow **must** be configured before the action will work. Below you'll find a description of what each one does.
59+
The `env` portion of the workflow **must** be configured before the action will work. You can add these in the `env` section found in the examples above. Any `secrets` must be referenced using the bracket syntax and stored in the GitHub repositories `Settings/Secrets` menu. You can learn more about setting environment variables with GitHub actions [here](https://help.github.com/en/articles/workflow-syntax-for-github-actions#jobsjob_idstepsenv).
60+
61+
Below you'll find a description of what each option does.
5062

5163
| Key | Value Information | Type | Required |
5264
| ------------- | ------------- | ------------- | ------------- |
@@ -59,6 +71,6 @@ The `secrets` and `env` portion of the workflow **must** be configured before th
5971
| `COMMIT_EMAIL` | Used to sign the commit, this should be your email. If not provided it will default to your username. | `env` | **No** |
6072
| `COMMIT_NAME` | Used to sign the commit, this should be your name. If not provided it will default to `username@users.noreply.github.com` | `env` | **No** |
6173

62-
With the action correctly configured you should see something similar to this in your GitHub actions workflow editor.
74+
With the action correctly configured you should see the workflow trigger the deployment under the configured conditions.
6375

6476
![Example](screenshot.png)

screenshot.png

26.3 KB
Loading

0 commit comments

Comments
 (0)