Skip to content

Commit

Permalink
Change auto deployment to use GitHub actions
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonFrings committed Nov 28, 2022
1 parent 65f8a16 commit fcd335b
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 2 deletions.
7 changes: 6 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@ name: CI
on:
push:
pull_request:
workflow_dispatch:

jobs:
Acceptance:
Deploy:
runs-on: ubuntu-22.04
strategy:
matrix:
Expand All @@ -20,3 +21,7 @@ jobs:
- run: make
- run: make served
- run: make test
- run: git config --global user.name "GitHub Actions" && git config --global user.email "actions@github.com"
- 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' && github.event_name != 'pull_request' }}
10 changes: 9 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,15 @@ test:
bash tests/acceptance.sh
test -z "$$(git status --porcelain)" || (echo Directory is dirty && git status && exit 1)

deploy:
git -C build/ init
git -C build/ checkout live 2>/dev/null || git -C build/ checkout -b live
git -C build/ add --all
git -C build/ diff-index HEAD >/dev/null 2>/dev/null || git -C build/ commit -m "Website build"
git -C build/ remote get-url origin >/dev/null 2>/dev/null || git -C build/ remote add origin $(shell git remote get-url origin)
git -C build/ push origin live -f

clean:
rm -rf build/ vendor/ tailwindcss

.PHONY: build serve served test clean
.PHONY: build serve served test deploy clean
16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# clue.engineering

[![CI status](https://github.com/clue/clue.engineering/workflows/CI/badge.svg)](https://github.com/clue/clue.engineering/actions)
[![Last deployed on `live`](https://img.shields.io/github/last-commit/clue/clue.engineering/live?label=last%20deployed&logo=github)](https://github.com/clue/clue.engineering/tree/live)

Source code for the https://clue.engineering/ website.

## Build
Expand Down Expand Up @@ -53,3 +56,16 @@ Additionally, this should be deployed behind a reverse proxy (nginx) that is
responsible for HTTPS certificate handling and forcing HTTPS redirects.

Additionally, Apache has been configured to cache static files for 1 day.

The live website is deployed by pushing the contents of the `build/` directory to
the `live` branch like this:

```bash
make deploy
```

## Auto-Deployment

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).

0 comments on commit fcd335b

Please sign in to comment.