Skip to content

Commit

Permalink
Add GitHub action to automatically build and deploy website
Browse files Browse the repository at this point in the history
  • Loading branch information
clue committed Aug 6, 2021
1 parent 2c1589c commit 8061642
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 0 deletions.
18 changes: 18 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Deploy

on:
push:
pull_request:
workflow_dispatch:

jobs:
Deploy:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- run: mkdir -p ~/.ssh && echo "${{ secrets.DEPLOY_KEY }}" > ~/.ssh/id_rsa && chmod 400 ~/.ssh/id_rsa
- run: git config --global user.name "GitHub Actions" && git config --global user.email "actions@github.com"
- run: make
- run: git config --global url."https://${{ github.actor }}:${{ secrets.GITHUB_TOKEN }}@github.com/".insteadOf "https://github.com/"
- run: make deploy
if: ${{ github.ref == 'refs/heads/main' }}
17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Framework X website

[![CI status](https://github.com/clue/framework-xwebsite/workflows/Deploy/badge.svg)](https://github.com/clue/framework-x-website/actions)

Source code for the Framework X website.

## Build
Expand Down Expand Up @@ -37,3 +39,18 @@ the `live` branch like this:
```bash
$ make deploy
```

## Auto-Deployment

The website can be automatically deployed via the GitHub Pages feature.

Any time a commit is merged (such as when a PR is merged), GitHub actions will
automatically build and deploy the website. This is done by running the above
deployment script (see previous chapter).

> Repository setup:
> Note that this command will clone Framework X which is currently in early access.
> We're using a read-only SSH deploy key for reading from this source repository.
> Make sure the required `DEPLOY_KEY` secret is set in the repository settings on GitHub.
> See [action documentation](https://github.com/JamesIves/github-pages-deploy-action#using-an-ssh-deploy-key-)
> for more details.

0 comments on commit 8061642

Please sign in to comment.