forked from thorsten/phpMyFAQ
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgit2package.sh
More file actions
executable file
·90 lines (73 loc) · 2.96 KB
/
Copy pathgit2package.sh
File metadata and controls
executable file
·90 lines (73 loc) · 2.96 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
#!/bin/sh
#
# This is the shell script for building:
# 1. a TAR.GZ package;
# 2. a ZIP package
# of phpMyFAQ using what committed into Git.
#
# For creating a package simply run:
#
# ./git2package.sh
#
# The script will download the source code from branch and
# it will create the 2 packages plus their MD5 hashes.
#
# This Source Code Form is subject to the terms of the Mozilla Public License,
# v. 2.0. If a copy of the MPL was not distributed with this file, You can
# obtain one at https://mozilla.org/MPL/2.0/.
#
# @package phpMyFAQ
# @author Matteo Scaramuccia <matteo@scaramuccia.com>
# @author Thorsten Rinne <thorsten@phpmyfaq.de>
# @author Rene Treffer <treffer+phpmyfaq@measite.de>
# @author David Soria Parra <dsp@php.net>
# @author Florian Anderiasch <florian@phpmyfaq.de>
# @copyright 2008-2025 phpMyFAQ Team
# @license https://www.mozilla.org/MPL/2.0/ Mozilla Public License Version 2.0
# @link https://www.phpmyfaq.de
# @version 2008-09-10
# phpMyFAQ Version
. scripts/version.sh
# Determine md5 binary
if [ -z "${MD5BIN}" ]; then
if command -v md5 > /dev/null; then
MD5BIN=$(command -v md5)
else
MD5BIN=$(command -v md5sum)
fi
fi
# Package Folder
if [ -z "${PMF_PACKAGE_FOLDER}" ]; then
PMF_PACKAGE_FOLDER="phpmyfaq-${PMF_VERSION}"
fi
current_dir=$(pwd) || exit
printf "\n 🚀 Checkout code into build/ folder\n"
git checkout-index -f -a --prefix="${current_dir}/build/checkout/${PMF_PACKAGE_FOLDER}/"
printf "\n 🚀 Add missing directories\n"
mkdir -p "${current_dir}/build/package/${PMF_PACKAGE_FOLDER}/"
cd "${current_dir}/build/checkout/${PMF_PACKAGE_FOLDER}/" || exit
printf "\n 🚀 Add PHP dependencies\n"
composer install --no-dev --prefer-dist
printf "\n 🚀 Install JS dependencies\n"
pnpm install
printf "\n 🚀 Run \"pnpm build:prod\" to build frontend production build\n"
pnpm build:prod
printf "\n 🚀 Remove fonts and examples from TCPDF\n"
rm -rf "${current_dir}/build/checkout/${PMF_PACKAGE_FOLDER}/phpmyfaq/src/libs/tecnickcom/tcpdf/fonts"
rm -rf "${current_dir}/build/checkout/${PMF_PACKAGE_FOLDER}/phpmyfaq/src/libs/tecnickcom/tcpdf/examples"
printf "\n 🚀 Create md5 hashes for file verification\n"
php scripts/createHashes.php > "${current_dir}/hashes-${PMF_VERSION}.json"
printf "\n 🚀 Prepare packaging\n"
cd "${current_dir}" || exit
mv "${current_dir}/build/checkout/${PMF_PACKAGE_FOLDER}/phpmyfaq" "${current_dir}/build/package/${PMF_PACKAGE_FOLDER}"
printf "\n 🚀 Build packages\n"
tar cfvz "${PMF_PACKAGE_FOLDER}.tar.gz" -C "${current_dir}/build/package/${PMF_PACKAGE_FOLDER}" phpmyfaq
cd "${current_dir}/build/package/${PMF_PACKAGE_FOLDER}" || exit
zip -r "${current_dir}/${PMF_PACKAGE_FOLDER}.zip" phpmyfaq
cd "${current_dir}" || exit
printf "\n 🚀 Create md5sum\n"
$MD5BIN "${PMF_PACKAGE_FOLDER}.tar.gz" > "${PMF_PACKAGE_FOLDER}.tar.gz.md5"
$MD5BIN "${PMF_PACKAGE_FOLDER}.zip" > "${PMF_PACKAGE_FOLDER}.zip.md5"
printf "\n 🚀 Clean up\n"
rm -rf "${current_dir}/build"
printf "\n 🚀 done.\n"