Skip to content

Commit dd9d741

Browse files
authored
Merge pull request #53 from clue-labs/github-ci
Use GitHub actions for continuous integration (CI)
2 parents 834c1f0 + a767084 commit dd9d741

File tree

10 files changed

+225
-74
lines changed

10 files changed

+225
-74
lines changed

.env.dist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
GITHUB_TOKEN=""
22
DEPLOY_REPO="reactphp/reactphp.github.io"
33
DEPLOY_TARGET_BRANCH="master"
4-
DEPLOY_URL=""
4+
DEPLOY_URL="https://reactphp.org"

.github/workflows/ci.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: Deploy
2+
3+
on:
4+
push:
5+
pull_request:
6+
workflow_dispatch:
7+
8+
jobs:
9+
Deploy:
10+
runs-on: ubuntu-20.04
11+
steps:
12+
- uses: actions/checkout@v2
13+
- uses: shivammathur/setup-php@v2
14+
with:
15+
php-version: 7.1
16+
- run: composer install
17+
- run: mkdir ~/.ssh && echo "${{ secrets.DEPLOY_KEY }}" > ~/.ssh/id_rsa && chmod 400 ~/.ssh/id_rsa
18+
- run: echo 'GITHUB_TOKEN="${{ secrets.GITHUB_TOKEN }}"' > .env && cat .env.dist >> .env
19+
- run: git config --global user.name "GitHub Actions" && git config --global user.email "[email protected]"
20+
- run: bin/build
21+
- run: bin/build --deploy --no-component-update
22+
if: ${{ github.ref == 'refs/heads/main' }}

.travis.yml

Lines changed: 0 additions & 34 deletions
This file was deleted.

README.md

Lines changed: 64 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
Website
2-
=======
1+
# Website
2+
3+
[![CI status](https://github.com/reactphp/website/workflows/CI/badge.svg)](https://github.com/reactphp/website/actions)
34

45
Source code of reactphp.org.
56

6-
Setup
7-
-----
7+
## Setup
88

99
1. Copy `.env.dist` to `.env` and add a
1010
[personal access token](https://github.com/settings/tokens) to the
@@ -17,20 +17,69 @@ Setup
1717

1818
2. Install dependencies with `$ composer install`.
1919

20-
Auto-Deployment with Travis CI
21-
------------------------------
20+
## Build
21+
22+
Once set up, you can build the website by executing this:
23+
24+
```bash
25+
$ bin/build
26+
```
27+
28+
This script will fetch all project repositories and then rebuild the entire website.
29+
The resulting static website will be built into the `tmp/build` directory.
30+
31+
If you're working on the website source code, you may want to skip fetching all
32+
components on every build like this:
33+
34+
```bash
35+
$ bin/build --no-component-update
36+
```
37+
38+
If you're working on the website CSS or Javascript code, you will have to
39+
rebuild the static assets like this:
40+
41+
```bash
42+
$ npm run-script build
43+
```
44+
45+
> Note that compiled assets are expected to change much less frequently and are
46+
under version control. Run `npm install` to install and later commit any changes
47+
in `static-files/assets/`.
48+
49+
## Deploy
50+
51+
Once built (see previous chapter), deployment is as simple as hosting the static
52+
website contents of the `tmp/build` directory behind a webserver of your choice.
53+
54+
We use GitHub Pages to deploy this to the live site. This is done by pushing the
55+
contents of the `tmp/build` directory to the repository hosted in
56+
[reactphp/reactphp.github.io](https://github.com/reactphp/reactphp.github.io).
57+
58+
This deployment can be started by executing this:
59+
60+
```bash
61+
$ bin/build --deploy
62+
```
63+
64+
Note that this will publish any changes you've made to your local repository,
65+
including any uncommitted ones. There should usually be no need to do this
66+
manually, see next chapter for auto-deployment.
67+
68+
## Auto-Deployment
69+
70+
The website can be automatically deployed via the GitHub Pages feature.
2271

23-
The website can be automatically deployed via the Travis CI
24-
[GitHub Pages Deployment](https://docs.travis-ci.com/user/deployment/pages/)
25-
feature.
72+
Any time a commit is merged (such as when a PR is merged), GitHub actions will
73+
automatically build and deploy the website. This is done by running the above
74+
deployment script (see previous chapter).
2675

27-
Make sure, the required environment variables are set in the repository settings
28-
on Travis CI: `GITHUB_TOKEN`
29-
([a personal access token](https://docs.travis-ci.com/user/deployment/pages/#Setting-the-GitHub-token)),
30-
`DEPLOY_REPO`, `DEPLOY_TARGET_BRANCH` and `DEPLOY_FQDN`.
76+
> Repository setup:
77+
> We're using a SSH deploy key for pushing to this target repository.
78+
> Make sure the required `DEPLOY_KEY` secret is set in the repository settings on GitHub.
79+
> See [action documentation](https://github.com/JamesIves/github-pages-deploy-action#using-an-ssh-deploy-key-)
80+
> for more details.
3181
32-
License
33-
-------
82+
## License
3483

3584
Released under the [MIT](LICENSE) license.
3685

bin/build

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ call_user_func(include $configFile, $container);
1616
function run($command, $cwd = null)
1717
{
1818
$process = new Symfony\Component\Process\Process($command, $cwd);
19-
$process->setTty(true);
2019

2120
$process->mustRun(function ($type, $buffer) {
2221
echo $buffer;

composer.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,5 +26,10 @@
2626
"elvanto/litemoji": "^1.0",
2727
"zendframework/zend-feed": "^2.10",
2828
"igorw/retry": "^1.0@dev"
29+
},
30+
"config": {
31+
"platform": {
32+
"php": "7.1.99"
33+
}
2934
}
3035
}

composer.lock

Lines changed: 114 additions & 18 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

config/berti.config.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@
66
// Ignore missing .env
77
}
88

9+
// use UTC timezone for all dates on website (release dates in changelogs)
10+
date_default_timezone_set('UTC');
11+
912
return function (Pimple\Container $container) {
1013
$container['markdown.cache'] = function () {
1114
return new Symfony\Component\Cache\Adapter\FilesystemAdapter(

0 commit comments

Comments
 (0)