Skip to content

Commit 32ccc9a

Browse files
Copilotnielsdrost7
andcommitted
Enhance workflow with user feedback: PHP 8.4, vendor cleaner, checksums, release notes
Co-authored-by: nielsdrost7 <47660417+nielsdrost7@users.noreply.github.com>
1 parent 2058e5a commit 32ccc9a

File tree

2 files changed

+147
-35
lines changed

2 files changed

+147
-35
lines changed

.github/workflows/release.yml

Lines changed: 140 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ jobs:
1717
steps:
1818
- name: Checkout repository
1919
uses: actions/checkout@v4
20+
with:
21+
fetch-depth: 0 # Fetch all history for release notes
2022

2123
# Step 1: Download translations from Crowdin
2224
- name: Download translations from Crowdin
@@ -26,65 +28,120 @@ jobs:
2628
localization_branch_name: master
2729
create_pull_request: false
2830
crowdin_branch_name: master
31+
config: 'crowdin.yml'
2932
env:
3033
CROWDIN_PROJECT_ID: ${{ secrets.CROWDIN_PROJECT_ID }}
3134
CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_PERSONAL_TOKEN }}
3235

33-
# Step 2: Set up Node.js for frontend build
36+
# Step 2: Validate translations
37+
- name: Validate translations directory
38+
run: |
39+
echo "Validating translations structure..."
40+
if [ ! -d "resources/lang/en" ]; then
41+
echo "ERROR: Missing required language directory: resources/lang/en"
42+
exit 1
43+
fi
44+
echo "✓ Translations structure validated"
45+
46+
# Step 3: Set up Node.js for frontend build
3447
- name: Set up Node.js
3548
uses: actions/setup-node@v4
3649
with:
3750
node-version: '20'
3851
cache: 'yarn'
3952

40-
- name: Install frontend dependencies
41-
run: yarn install --frozen-lockfile
53+
- name: Install frontend dependencies (production mode)
54+
run: |
55+
echo "Installing frontend dependencies..."
56+
yarn install --frozen-lockfile --production=false
57+
echo "✓ Frontend dependencies installed"
4258
4359
- name: Build frontend assets for production
44-
run: yarn build
60+
run: |
61+
echo "Building frontend assets..."
62+
yarn build
63+
echo "✓ Frontend assets built successfully"
4564
46-
# Step 3: Set up PHP and Composer
65+
# Step 4: Set up PHP and Composer
4766
- name: Set up PHP
4867
uses: shivammathur/setup-php@v2
4968
with:
50-
php-version: '8.3' # Using 8.3; composer.json requires ^8.2
51-
extensions: mbstring, bcmath, pdo_mysql
69+
php-version: '8.4'
70+
extensions: gd, bcmath, dom, intl, xml, zip, mbstring, pdo_mysql
5271
coverage: none
5372

73+
- name: Display tool versions
74+
run: |
75+
echo "========================================="
76+
echo "Tool Versions"
77+
echo "========================================="
78+
echo "PHP version: $(php -v | head -n 1)"
79+
echo "Composer version: $(composer --version)"
80+
echo "Node.js version: $(node -v)"
81+
echo "npm version: $(npm -v)"
82+
echo "Yarn version: $(yarn -v)"
83+
echo "========================================="
84+
5485
- name: Install Composer dependencies (production)
5586
run: |
87+
echo "Installing Composer dependencies (production mode)..."
5688
composer install --no-dev --optimize-autoloader \
5789
--no-interaction --prefer-dist
90+
echo "✓ Composer dependencies installed"
5891
59-
# Step 4: Clean up node_modules
60-
- name: Remove node_modules
61-
run: rm -rf node_modules
62-
63-
# Step 5: Clean vendor directory to minimize size
64-
- name: Optimize vendor directory
92+
- name: Install and run vendor cleaner
6593
run: |
66-
# Remove unnecessary files from vendor
67-
find vendor -type d \( -name "tests" -o -name "test" \
68-
-o -name "Tests" -o -name "Test" -o -name "docs" \
69-
-o -name "doc" -o -name ".git" \) \
70-
-exec rm -rf {} + 2>/dev/null || true
71-
find vendor -type f \( -name "*.md" -o -name "*.txt" \
72-
-o -name ".gitignore" -o -name ".gitattributes" \
73-
-o -name "composer.json" -o -name "composer.lock" \
74-
-o -name "phpunit.xml" -o -name "phpunit.xml.dist" \
75-
-o -name ".php_cs" -o -name ".php_cs.dist" \
76-
-o -name "phpstan.neon" -o -name "phpstan.neon.dist" \) \
77-
-delete 2>/dev/null || true
94+
echo "Installing composer-vendor-cleaner..."
95+
composer require liborm85/composer-vendor-cleaner --dev --no-interaction
96+
echo "Running vendor cleanup..."
97+
composer vendor-cleaner
98+
echo "✓ Vendor directory optimized"
99+
100+
# Step 5: Cleanup workspace
101+
- name: Clean workspace
102+
run: |
103+
echo "========================================="
104+
echo "Cleaning Workspace"
105+
echo "========================================="
106+
107+
echo "Removing npm dependencies (node_modules)..."
108+
rm -rf node_modules
109+
110+
echo "Removing .DS_Store files..."
111+
find . -type f -name '.DS_Store' -delete
112+
113+
echo "Cleaning mPDF fonts (keeping only DejaVu)..."
114+
find vendor/mpdf/mpdf/ttfonts ! -name 'DejaVu*' -type f -exec rm -f {} + 2>/dev/null || true
115+
116+
echo "Cleaning mPDF QR code data..."
117+
rm -rf vendor/mpdf/mpdf/src/QrCode/data/* 2>/dev/null || true
118+
119+
echo "Removing .git directories from vendor..."
120+
find vendor -name '.git' -type d -exec rm -rf {} + 2>/dev/null || true
121+
122+
echo "Removing .github directories..."
123+
rm -rf .github
124+
125+
echo "✓ Workspace cleaned successfully"
126+
echo "========================================="
78127
79128
# Step 6: Create release archive
80-
- name: Create release zip
129+
- name: Package InvoicePlane
81130
run: |
131+
echo "========================================="
132+
echo "Creating Release Package"
133+
echo "========================================="
134+
82135
# Create a timestamp for the release
83136
TIMESTAMP=$(date +%Y%m%d_%H%M%S)
84137
RELEASE_NAME="invoiceplane-v2-${TIMESTAMP}"
138+
RELEASE_FILE="${RELEASE_NAME}.zip"
85139
140+
echo "Package name: ${RELEASE_FILE}"
141+
86142
# Create zip excluding unnecessary files
87-
zip -r "${RELEASE_NAME}.zip" . \
143+
echo "Creating ZIP archive (this may take a moment)..."
144+
zip -q -r -9 "${RELEASE_FILE}" . \
88145
-x "*.git*" \
89146
-x "node_modules/*" \
90147
-x "tests/*" \
@@ -103,20 +160,68 @@ jobs:
103160
-x ".editorconfig" \
104161
-x ".prettierrc" \
105162
-x "docker-compose.yml" \
106-
-x "README.md" \
107-
-x ".github/*" \
108163
-x "yarn.lock" \
109164
-x "package.json" \
110165
-x "vite.config.js" \
111-
-x "tailwind.config.js"
112-
166+
-x "tailwind.config.js" \
167+
-x ".DS_Store"
168+
169+
echo "✓ Package created successfully"
170+
171+
echo "Generating checksums..."
172+
sha256sum "${RELEASE_FILE}" > sha256.txt
173+
md5sum "${RELEASE_FILE}" > md5.txt
174+
175+
echo "SHA256: $(cat sha256.txt)"
176+
echo "MD5: $(cat md5.txt)"
177+
echo "✓ Checksums generated"
178+
113179
echo "RELEASE_NAME=${RELEASE_NAME}" >> $GITHUB_ENV
114-
echo "RELEASE_FILE=${RELEASE_NAME}.zip" >> $GITHUB_ENV
115-
116-
# Step 7: Upload release artifact
180+
echo "RELEASE_FILE=${RELEASE_FILE}" >> $GITHUB_ENV
181+
182+
echo "========================================="
183+
echo "Package Details"
184+
echo "========================================="
185+
ls -lh "${RELEASE_FILE}"
186+
echo "========================================="
187+
188+
# Step 7: Generate release notes
189+
- name: Generate release notes
190+
id: release_notes
191+
run: |
192+
echo "Generating release notes..."
193+
194+
# Get the latest tag or use initial commit if no tags
195+
PREVIOUS_TAG=$(git describe --tags --abbrev=0 2>/dev/null || git rev-list --max-parents=0 HEAD)
196+
197+
# Generate changelog
198+
echo "## Changes since ${PREVIOUS_TAG}" > RELEASE_NOTES.md
199+
echo "" >> RELEASE_NOTES.md
200+
git log ${PREVIOUS_TAG}..HEAD --pretty=format:"- %s (%h)" >> RELEASE_NOTES.md
201+
202+
echo "✓ Release notes generated"
203+
cat RELEASE_NOTES.md
204+
205+
# Step 8: Upload release artifact
117206
- name: Upload release artifact
118207
uses: actions/upload-artifact@v4
119208
with:
120209
name: ${{ env.RELEASE_NAME }}
121-
path: ${{ env.RELEASE_FILE }}
210+
path: |
211+
${{ env.RELEASE_FILE }}
212+
sha256.txt
213+
md5.txt
214+
RELEASE_NOTES.md
122215
retention-days: 90
216+
217+
# Step 9: Workflow complete
218+
- name: Workflow summary
219+
run: |
220+
echo "========================================="
221+
echo "INVOICEPLANE V2 WORKFLOW COMPLETED"
222+
echo "========================================="
223+
echo "Package: ${{ env.RELEASE_FILE }}"
224+
echo "Artifact name: ${{ env.RELEASE_NAME }}"
225+
echo "Checksums: sha256.txt, md5.txt"
226+
echo "Release notes: RELEASE_NOTES.md"
227+
echo "========================================="

crowdin.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
project_id_env: CROWDIN_PROJECT_ID
2+
api_token_env: CROWDIN_PERSONAL_TOKEN
3+
preserve_hierarchy: true
4+
5+
files:
6+
- source: /resources/lang/en/**/*.php
7+
translation: /resources/lang/%two_letters_code%/**/%original_file_name%

0 commit comments

Comments
 (0)