Skip to content

Commit 1191211

Browse files
authored
Initialize app to render documents in web pages (#1)
1 parent 24bbb83 commit 1191211

40 files changed

+8155
-0
lines changed

.editorconfig

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# https://editorconfig.org
2+
root = true
3+
4+
# Unix-style newlines with a newline ending every file
5+
[*]
6+
charset = utf-8
7+
end_of_line = lf
8+
insert_final_newline = true
9+
indent_style = tab
10+
indent_size = 4
11+
12+
# Markdown
13+
[*.{md,markdown}]
14+
indent_style = space
15+
indent_size = 2
16+
17+
# YAML
18+
[*.{yml,yaml}]
19+
indent_style = space
20+
indent_size = 2
21+
22+
# JSON
23+
[**.{json}]
24+
indent_style = space
25+
indent_size = 2

.env

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
COMPOSE_PROJECT_NAME='fluffevent-association-documents-site'
2+
IMAGES_PREFIX='fluffevent-association-documents-site'
3+
4+
# Override these values with your own in `.env.local`:
5+
6+
# HTTP ports
7+
HTTP_PORT='' # Exposed port
8+
HTTP_DOCKER_PORT='' # Container port
9+
10+
# Application configuration
11+
GITHUB_REPOSITORY_URL=''
12+
GITHUB_SHA=''

.github/workflows/check.yml

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
name: Check CI
2+
3+
on:
4+
5+
# Run on pull requests to primary branches
6+
pull_request:
7+
branches:
8+
- main
9+
- dev
10+
paths:
11+
- '.github/workflows/check.yml'
12+
- 'app/**'
13+
- 'docker-compose.yml'
14+
- 'docker-compose.cicd.yml'
15+
16+
# Run on manual triggers
17+
workflow_dispatch:
18+
19+
# Set GITHUB_TOKEN permissions for the workflow
20+
permissions:
21+
contents: read
22+
23+
# Set workflow concurrency rules
24+
concurrency:
25+
group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.ref }}
26+
cancel-in-progress: true
27+
28+
jobs:
29+
30+
# Build job
31+
build:
32+
name: Build
33+
runs-on: ubuntu-latest
34+
timeout-minutes: 20
35+
36+
steps:
37+
38+
- name: Checkout
39+
uses: actions/checkout@v4
40+
41+
- name: Download FluffEvent association documents
42+
run: |
43+
# download-documents.sh ./app/app
44+
sh ./cicd/download-documents.sh ./app/app
45+
46+
- name: Build for production
47+
env:
48+
GITHUB_REPOSITORY_URL: https://github.com/${{ github.repository }}
49+
GITHUB_SHA: ${{ github.sha }}
50+
BUILD_CHECK: "true" # Run type checks
51+
run: |
52+
# docker compose build
53+
docker compose \
54+
-f docker-compose.yml -f docker-compose.cicd.yml \
55+
--env-file .env \
56+
build
57+
58+
- name: Copy application files
59+
run: |
60+
# docker compose up
61+
docker compose \
62+
-f docker-compose.yml -f docker-compose.cicd.yml \
63+
--env-file .env \
64+
up
65+
66+
- name: Chown dist folder to $USER
67+
run: |
68+
# chown $USER ./app/dist
69+
sudo chown -R $USER:$USER ./app/dist
70+
71+
- name: Check application files
72+
run: |
73+
# Verify some application files exist
74+
[ -d ./app/dist ] && [ $(ls -1 ./app/dist | wc -l) -gt 0 ] \
75+
&& echo "Application files found" \
76+
|| ( echo "No application files found" && exit 1 )

.github/workflows/deploy.yml

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
name: Deploy CD
2+
3+
on:
4+
5+
# Run on push on production branches
6+
push:
7+
branches:
8+
- main
9+
paths:
10+
- '.github/workflows/deploy.yml'
11+
- 'app/**'
12+
- 'docker-compose.yml'
13+
- 'docker-compose.cicd.yml'
14+
15+
# Run on manual triggers
16+
workflow_dispatch:
17+
18+
# Set GITHUB_TOKEN permissions for the workflow
19+
permissions:
20+
contents: read
21+
22+
# Set workflow concurrency rules
23+
concurrency:
24+
group: ${{ github.workflow }}
25+
cancel-in-progress: true
26+
27+
jobs:
28+
29+
# Build job
30+
build:
31+
name: Build
32+
runs-on: ubuntu-latest
33+
timeout-minutes: 20
34+
35+
steps:
36+
37+
- name: Checkout
38+
uses: actions/checkout@v4
39+
40+
- name: Download FluffEvent association documents
41+
run: |
42+
# download-documents.sh ./app/app
43+
sh ./cicd/download-documents.sh ./app/app
44+
45+
- name: Build for production
46+
env:
47+
GITHUB_REPOSITORY_URL: https://github.com/${{ github.repository }}
48+
GITHUB_SHA: ${{ github.sha }}
49+
BUILD_CHECK: "false" # Skip type checks
50+
run: |
51+
# docker compose build
52+
docker compose \
53+
-f docker-compose.yml -f docker-compose.cicd.yml \
54+
--env-file .env \
55+
build
56+
57+
- name: Copy application files
58+
run: |
59+
# docker compose up
60+
docker compose \
61+
-f docker-compose.yml -f docker-compose.cicd.yml \
62+
--env-file .env \
63+
up
64+
65+
- name: Chown dist folder to $USER
66+
run: |
67+
# chown $USER ./app/dist
68+
sudo chown -R $USER:$USER ./app/dist
69+
70+
- name: Upload artifact
71+
uses: actions/upload-pages-artifact@v3
72+
with:
73+
path: ./app/dist
74+
75+
# Deploy job
76+
deploy:
77+
name: Deploy
78+
runs-on: ubuntu-latest
79+
timeout-minutes: 10
80+
81+
# Job dependencies
82+
needs:
83+
- build
84+
85+
# Set GITHUB_TOKEN permissions for the job
86+
permissions:
87+
pages: write
88+
id-token: write
89+
90+
# Set deployment environment
91+
environment:
92+
name: production
93+
url: ${{ steps.deployment.outputs.page_url }}
94+
95+
steps:
96+
97+
- name: Deploy to GitHub Pages
98+
id: deployment
99+
uses: actions/deploy-pages@v4

.gitignore

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
# -- Generic rules:
2+
3+
# Environment files
4+
.env*.local
5+
6+
# Temporary files
7+
._*
8+
*.cache
9+
*.log*
10+
*.swp
11+
*~
12+
13+
# System files
14+
.DS_Store
15+
Thumbs.db
16+
17+
# -- Editor rules:
18+
19+
# VS Code
20+
.vscode/**/*
21+
!.vscode/extensions.json
22+
23+
# Jetbrains
24+
.idea/
25+
26+
# Other
27+
*.suo
28+
*.ntvs*
29+
*.njsproj
30+
*.sln
31+
*.sw?
32+
33+
# -- Application rules:
34+
35+
# Node.js
36+
node_modules/
37+
dist/
38+
39+
# Astro
40+
.astro/
41+
.vite/
42+
43+
# Application environment files
44+
*/**/.env*
45+
46+
# -- Specific to gitignore:
47+
48+
# Build configuration files (allow)
49+
!Dockerfile
50+
!Makefile

.vscode/extensions.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"recommendations": [
3+
"astro-build.astro-vscode"
4+
],
5+
"unwantedRecommendations": []
6+
}

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2024 Matiboux
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
11
# Fluff Event association documents website
22

33
Astro web application project to render the Fluff Event association documents in printable web pages.
4+
5+
6+
## License
7+
8+
Copyright (c) 2024 [Matiboux](https://github.com/matiboux) ([matiboux.me](https://matiboux.me))
9+
10+
Licensed under the [MIT License](https://opensource.org/license/MIT). You can see a copy in the [LICENSE](LICENSE) file.

app/.dockerignore

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# -- Generic rules:
2+
3+
# Environment files
4+
.env*.local
5+
6+
# Temporary files
7+
._*
8+
*.cache
9+
*.log*
10+
*.swp
11+
*~
12+
13+
# System files
14+
.DS_Store
15+
Thumbs.db
16+
17+
# -- Editor rules:
18+
19+
# VS Code
20+
.vscode/**/*
21+
!.vscode/extensions.json
22+
23+
# Jetbrains
24+
.idea/
25+
26+
# Other
27+
*.suo
28+
*.ntvs*
29+
*.njsproj
30+
*.sln
31+
*.sw?
32+
33+
# -- Application rules:
34+
35+
# Node.js
36+
node_modules/
37+
dist/
38+
39+
# Astro
40+
.astro/
41+
.vite/
42+
43+
# Application environment files
44+
*/**/.env*
45+
46+
# -- Specific to dockerignore:
47+
48+
# Docker configuration files
49+
Dockerfile
50+
docker-compose*.yml
51+
52+
# Dotfiles
53+
.*

0 commit comments

Comments
 (0)