Skip to content

Commit 65c8c93

Browse files
committed
Simplify build process by removing built site from version control
Previously, the site was served via the `docs` folder checked into version control. This required building the site and checking it in every time anything changed. This commit changes this process by removing the built site from version control in favor of building and deploying it on each merge to main. It is still possible to build and preview the site locally. The only difference is the site is built into and served from the "dist" folder instead of the "docs" folder, using a much more predictable folder name.
1 parent f3ecde7 commit 65c8c93

File tree

128 files changed

+59
-17855
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

128 files changed

+59
-17855
lines changed

.dockerignore

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,9 @@
22
.github
33
vendor
44
node_modules
5-
docs
5+
dist
66
.dockerignore
77
Dockerfile
88
docker-compose.yml
99
.gitignore
10-
.gitattributes
1110
README.md

.gitattributes

Lines changed: 0 additions & 1 deletion
This file was deleted.

.github/workflows/build-check.sh

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

.github/workflows/build-check.yml

Lines changed: 0 additions & 31 deletions
This file was deleted.
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
on:
2+
push:
3+
branches:
4+
- main
5+
6+
jobs:
7+
build:
8+
runs-on: ubuntu-latest
9+
10+
steps:
11+
- name: Checkout
12+
uses: actions/checkout@v4
13+
14+
- name: Setup PHP
15+
uses: shivammathur/setup-php@v2
16+
with:
17+
php-version: 8.3
18+
19+
- name: Install PHP dependencies
20+
run: composer install
21+
22+
- name: Build website
23+
run: composer build
24+
25+
- name: Setup GitHub Pages
26+
uses: actions/configure-pages@v4
27+
28+
- name: Upload built site
29+
uses: actions/upload-pages-artifact@v3
30+
with:
31+
path: './dist'
32+
33+
deploy:
34+
needs: build
35+
36+
permissions:
37+
pages: write
38+
id-token: write
39+
40+
environment:
41+
name: github-pages
42+
url: ${{ steps.deployment.outputs.page_url }}
43+
44+
runs-on: ubuntu-latest
45+
46+
steps:
47+
- name: Deploy to GitHub Pages
48+
id: deployment
49+
uses: actions/deploy-pages@v4

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@
22
.DS_Store
33
.phpunit.cache/
44
.phpunit.result.cache
5+
dist
56
vendor

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ build-site: build
3737

3838
# Serve the site
3939
serve: build
40-
docker run --rm -p $(HOST_PORT):$(CONTAINER_PORT) -v $(PWD):/var/www/html --name $(CONTAINER_NAME) $(IMAGE_NAME) php -S 0.0.0.0:$(CONTAINER_PORT) -t docs/
40+
docker run --rm -p $(HOST_PORT):$(CONTAINER_PORT) -v $(PWD):/var/www/html --name $(CONTAINER_NAME) $(IMAGE_NAME) php -S 0.0.0.0:$(CONTAINER_PORT) -t dist/
4141

4242
# Run tests
4343
test: build

README.md

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ Next, build the site by running
3535
composer build
3636
```
3737
**Important:** You _must_ run build every time you are changing meetup data or any files in the
38-
`public` or `templates` directories. This will re-generate the `docs` directory. Verboseness
38+
`public` or `templates` directories. This will re-generate the `dist` directory. Verboseness
3939
can be controlled with `-v` to `-vvv` switches
4040

4141
To view the site:
@@ -71,15 +71,9 @@ composer test
7171

7272
Directory structure
7373
-------------------
74-
### docs
75-
The live copy of the site is here. It _is_ under version control because GitHub pages serves
76-
the site directly from this folder. Do not add or modify any files in this directory by hand;
77-
any changes will be lost in the next build.
78-
79-
If you make changes to any files, the changes to the `docs` directory must be **in the same commit**.
80-
81-
Note: `dist` would be a better name for this folder, but [due to GitHub limitations][1] it must
82-
be named docs.
74+
### dist
75+
The live copy of the site is here once built. It is not under version control; if you need to
76+
update the site you should update files in one of the other directories below.
8377

8478
### public
8579
Files that need to be available on the live site (for example images and stylesheets) are in
@@ -100,6 +94,3 @@ Other
10094
Sculpin proved not to be customizable enough with regard to custom archive pages.
10195
No other static site generators offered a featureset comparable Sculpin or what has been built
10296
in this project.
103-
104-
105-
[1]: https://docs.github.com/en/pages/getting-started-with-github-pages/configuring-a-publishing-source-for-your-github-pages-site#about-publishing-sources

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
"lint": "phpcs",
4141
"serve": [
4242
"Composer\\Config::disableProcessTimeout",
43-
"php -S localhost:8000 -t docs/"
43+
"php -S localhost:8000 -t dist/"
4444
],
4545
"test": "phpunit --colors=always --testdox tests"
4646
},

console.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
$application = new Application();
1414

1515
$application->add(new MeetupGeneratorCommand(new MeetupGeneratorService(__DIR__ . '/src/Meetup')));
16-
$application->add(new SiteBuilderCommand(__DIR__ . '/docs'));
16+
$application->add(new SiteBuilderCommand(__DIR__ . '/dist'));
1717

1818
/** @noinspection PhpUnhandledExceptionInspection */
1919
$application->run();

0 commit comments

Comments
 (0)