Skip to content

Commit c1b2a2a

Browse files
authored
Update packages & build config (#14)
1 parent e438759 commit c1b2a2a

39 files changed

Lines changed: 7861 additions & 9397 deletions

.env

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,12 @@
1-
COMPOSE_PROJECT_NAME='fluff-votes'
2-
IMAGES_PREFIX='fluff-votes'
1+
COMPOSE_PROJECT_NAME='fluffevent-votes'
2+
IMAGES_PREFIX='fluffevent-votes'
33

44
# 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: 60 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,31 @@
11
name: Check CI
22

33
on:
4-
# Run on pull requests events on primary branches
4+
5+
# Run on pull requests to primary branches
56
pull_request:
67
branches:
8+
# Production
79
- main
10+
# Development
811
- dev
912
paths:
13+
# CI files
14+
- '.github/workflows/check.yml'
15+
- 'docker-compose.yml'
16+
- 'docker-compose.cicd.yml'
17+
- '.env'
18+
# Application files
1019
- 'app/**'
1120

12-
# Set GITHUB_TOKEN permissions
21+
# Run on manual triggers
22+
workflow_dispatch:
23+
24+
# Set GITHUB_TOKEN permissions for the workflow
1325
permissions:
1426
contents: read
1527

16-
# Allow one concurrent deployment
28+
# Set workflow concurrency rules
1729
concurrency:
1830
group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.ref }}
1931
cancel-in-progress: true
@@ -24,14 +36,50 @@ jobs:
2436
build:
2537
name: Build
2638
runs-on: ubuntu-latest
27-
timeout-minutes: 10
39+
timeout-minutes: 15
2840

2941
steps:
30-
- name: Checkout
31-
uses: actions/checkout@v4
32-
33-
- name: Build application files
34-
run: docker compose -f docker-compose.yml -f docker-compose.cicd.yml build
35-
env:
36-
GITHUB_REPOSITORY_URL: https://github.com/${{ github.repository }}
37-
GITHUB_SHA: ${{ github.sha }}
42+
43+
# Steps dependencies
44+
45+
- name: Checkout
46+
uses: actions/checkout@v4
47+
48+
# Execution steps
49+
50+
- name: Pull dependencies
51+
run: |
52+
# docker compose pull --ignore-buildable
53+
docker compose \
54+
-f ./docker-compose.yml -f ./docker-compose.cicd.yml \
55+
--env-file .env \
56+
pull --ignore-buildable
57+
58+
- name: Build for production
59+
env:
60+
GITHUB_REPOSITORY_URL: https://github.com/${{ github.repository }}
61+
GITHUB_SHA: ${{ github.sha }}
62+
BUILD_CHECK: "true" # Run type checks
63+
run: |
64+
# docker compose build
65+
export DOCKER_UID="$(id -u)"
66+
docker compose \
67+
-f ./docker-compose.yml -f ./docker-compose.cicd.yml \
68+
--env-file .env \
69+
build
70+
71+
- name: Copy application files
72+
run: |
73+
# docker compose up
74+
export DOCKER_UID="$(id -u)"
75+
docker compose \
76+
-f ./docker-compose.yml -f ./docker-compose.cicd.yml \
77+
--env-file .env \
78+
up
79+
80+
- name: Check application files
81+
run: |
82+
# Check application files
83+
[ -d ./app/dist ] && [ $(ls -1 ./app/dist | wc -l) -gt 0 ] \
84+
&& echo "Application files found" \
85+
|| ( echo "No application files found" && exit 1 )

.github/workflows/deploy.yml

Lines changed: 66 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,29 @@
1-
name: Deploy to GitHub Pages
1+
name: Deploy CD
22

33
on:
4-
# Run on push events on primary branches
4+
5+
# Run on push on production branches
56
push:
67
branches:
8+
# Production
79
- main
810
paths:
11+
# CI files
12+
- '.github/workflows/deploy.yml'
13+
- 'docker-compose.yml'
14+
- 'docker-compose.cicd.yml'
15+
- '.env'
16+
# Application files
917
- 'app/**'
1018

1119
# Run on manual triggers
1220
workflow_dispatch:
1321

14-
# Set GITHUB_TOKEN permissions
22+
# Set GITHUB_TOKEN permissions for the workflow
1523
permissions:
1624
contents: read
1725

18-
# Allow one concurrent deployment
26+
# Set workflow concurrency rules
1927
concurrency:
2028
group: ${{ github.workflow }}
2129
cancel-in-progress: true
@@ -24,52 +32,76 @@ jobs:
2432

2533
# Build job
2634
build:
27-
name: Build Astro site artifact
35+
name: Build
2836
runs-on: ubuntu-latest
29-
timeout-minutes: 10
37+
timeout-minutes: 15
3038

3139
steps:
32-
- name: Checkout
33-
uses: actions/checkout@v4
34-
35-
- name: Build for production
36-
run: docker compose -f docker-compose.yml -f docker-compose.cicd.yml build
37-
env:
38-
GITHUB_REPOSITORY_URL: https://github.com/${{ github.repository }}
39-
GITHUB_SHA: ${{ github.sha }}
40-
41-
- name: Copy application files
42-
run: docker compose -f docker-compose.yml -f docker-compose.cicd.yml run --rm app
4340

44-
- name: Chown dist folder to $USER
45-
run: sudo chown -R $USER:$USER ./app/dist
46-
47-
- name: Upload artifact
48-
uses: actions/upload-pages-artifact@v3
49-
with:
50-
path: ./app/dist
51-
52-
# Deployment job
41+
# Steps dependencies
42+
43+
- name: Checkout
44+
uses: actions/checkout@v4
45+
46+
# Execution steps
47+
48+
- name: Pull dependencies
49+
run: |
50+
# docker compose pull --ignore-buildable
51+
docker compose \
52+
-f ./docker-compose.yml -f ./docker-compose.cicd.yml \
53+
--env-file .env \
54+
pull --ignore-buildable
55+
56+
- name: Build for production
57+
env:
58+
GITHUB_REPOSITORY_URL: https://github.com/${{ github.repository }}
59+
GITHUB_SHA: ${{ github.sha }}
60+
BUILD_CHECK: "false" # Skip type checks
61+
run: |
62+
# docker compose build
63+
export DOCKER_UID="$(id -u)"
64+
docker compose \
65+
-f ./docker-compose.yml -f ./docker-compose.cicd.yml \
66+
--env-file .env \
67+
build
68+
69+
- name: Copy application files
70+
run: |
71+
# docker compose up
72+
export DOCKER_UID="$(id -u)"
73+
docker compose \
74+
-f ./docker-compose.yml -f ./docker-compose.cicd.yml \
75+
--env-file .env \
76+
up
77+
78+
- name: Upload GitHub Pages artifact
79+
uses: actions/upload-pages-artifact@v3
80+
with:
81+
path: ./app/dist
82+
83+
# Deploy job
5384
deploy:
54-
name: Deploy to GitHub Pages
85+
name: Deploy
5586
runs-on: ubuntu-latest
56-
timeout-minutes: 5
87+
timeout-minutes: 10
5788

58-
# Dependencies
89+
# Job dependencies
5990
needs:
6091
- build
6192

62-
# Sets permissions for the GITHUB_TOKEN
93+
# Set GITHUB_TOKEN permissions for the job
6394
permissions:
6495
pages: write
6596
id-token: write
6697

67-
# Sets the GitHub Pages deployment
98+
# Set deployment environment
6899
environment:
69100
name: production
70101
url: ${{ steps.deployment.outputs.page_url }}
71102

72103
steps:
73-
- name: Deploy to GitHub Pages
74-
id: deployment
75-
uses: actions/deploy-pages@v4
104+
105+
- name: Deploy to GitHub Pages
106+
id: deployment
107+
uses: actions/deploy-pages@v4

.gitignore

Lines changed: 49 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,49 @@
1-
# -- Generic rules:
2-
3-
# Environment files
4-
.env.local
5-
.env.*.local
6-
7-
# Temporary files
8-
._*
9-
*~
10-
*.cache
11-
*.log*
12-
*.swp
13-
14-
# System files
15-
.DS_Store
16-
Thumbs.db
17-
18-
# -- Application rules:
19-
20-
# Node
21-
node_modules/
22-
23-
# Astro
24-
.astro/
25-
dist/
26-
27-
# Jekyll
28-
_site/
29-
.jekyll-cache/
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+
.pnpm-store/
38+
dist/
39+
40+
# Astro
41+
.astro/
42+
.vite/
43+
44+
# Application environment files
45+
*/**/.env*
46+
47+
# -- Specific to gitignore:
48+
49+
# N/A

.vscode/extensions.json

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

0 commit comments

Comments
 (0)