File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -3,9 +3,10 @@ name: CI
33on :
44 push :
55 pull_request :
6+ workflow_dispatch :
67
78jobs :
8- Acceptance :
9+ Deploy :
910 runs-on : ubuntu-22.04
1011 strategy :
1112 matrix :
2021 - run : make
2122 - run : make served
2223 - run : make test
24+ - run : git config --global user.name "GitHub Actions" && git config --global user.email "actions@github.com"
25+ - run : git config --global url."https://${{ github.actor }}:${{ secrets.GITHUB_TOKEN }}@github.com/".insteadOf "https://github.com/"
26+ - run : make deploy
27+ if : ${{ github.ref == 'refs/heads/main' && github.event_name != 'pull_request' }}
Original file line number Diff line number Diff line change 2424 bash tests/acceptance.sh
2525 test -z " $$ (git status --porcelain)" || (echo Directory is dirty && git status && exit 1)
2626
27+ deploy :
28+ git -C build/ init
29+ git -C build/ checkout live 2> /dev/null || git -C build/ checkout -b live
30+ git -C build/ add --all
31+ git -C build/ diff-index HEAD > /dev/null 2> /dev/null || git -C build/ commit -m " Website build"
32+ git -C build/ remote get-url origin > /dev/null 2> /dev/null || git -C build/ remote add origin $(shell git remote get-url origin)
33+ git -C build/ push origin live -f
34+
2735clean :
2836 rm -rf build/ vendor/ tailwindcss
2937
30- .PHONY : build serve served test clean
38+ .PHONY : build serve served test deploy clean
Original file line number Diff line number Diff line change @@ -52,4 +52,15 @@ directory behind your favorite web server (Apache + PHP-FPM etc.).
5252Additionally, this should be deployed behind a reverse proxy (nginx) that is
5353responsible for HTTPS certificate handling and forcing HTTPS redirects.
5454
55- Additionally, Apache has been configured to cache static files for 1 day.
55+ The live website is deployed by pushing the contents of the ` build/ ` directory to
56+ the ` live ` branch like this:
57+
58+ ``` bash
59+ make deploy
60+ ```
61+
62+ ## Auto-Deployment
63+
64+ Any time a commit is merged (such as when a PR is merged), GitHub actions will
65+ automatically build and deploy the website. This is done by running the above
66+ deployment script (see previous chapter).
You can’t perform that action at this time.
0 commit comments