Merge branch 'master' into feature/compliance-scale
commit
81d5276604
|
@ -0,0 +1,87 @@
|
||||||
|
name: MonarcAppFO releases
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [ 'master' ]
|
||||||
|
tags: [ 'v*.*', 'v*.*.*', 'v*.*.*-*' ]
|
||||||
|
pull_request:
|
||||||
|
branches: [ 'master' ]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: ubuntu-20.04
|
||||||
|
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
node-version: [ "16.x" ]
|
||||||
|
php-version: [ "7.4" ]
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- name: install deps
|
||||||
|
run: sudo apt-get update && sudo apt install -y gettext
|
||||||
|
|
||||||
|
# PHP
|
||||||
|
- name: Setup PHP
|
||||||
|
uses: shivammathur/setup-php@v2
|
||||||
|
with:
|
||||||
|
php-version: ${{ matrix.php-version }}
|
||||||
|
tools: composer:v2.3
|
||||||
|
extensions: bcmath
|
||||||
|
|
||||||
|
- name: Validate composer.json and composer.lock
|
||||||
|
run: composer validate
|
||||||
|
|
||||||
|
- name: Install PHP dependencies
|
||||||
|
run: composer install --prefer-dist --no-progress --no-suggest --no-dev
|
||||||
|
|
||||||
|
- name: Symlink Monarc modules
|
||||||
|
run: |
|
||||||
|
mkdir -p module/Monarc
|
||||||
|
ln -s ../../vendor/monarc/core module/Monarc/Core
|
||||||
|
ln -s ../../vendor/monarc/frontoffice module/Monarc/FrontOffice
|
||||||
|
|
||||||
|
# javascript
|
||||||
|
- name: Use Node.js ${{ matrix.node-version }}
|
||||||
|
uses: actions/setup-node@v1
|
||||||
|
with:
|
||||||
|
node-version: ${{ matrix.node-version }}
|
||||||
|
|
||||||
|
- name: Install dependencies
|
||||||
|
run: |
|
||||||
|
npm install
|
||||||
|
head node_modules/ng_client/src/ClientApp.js
|
||||||
|
|
||||||
|
- name: Install ng-anr dependencies
|
||||||
|
run: |
|
||||||
|
npm install
|
||||||
|
working-directory: node_modules/ng_anr/
|
||||||
|
|
||||||
|
- name: Install ng-client dependencies
|
||||||
|
run: |
|
||||||
|
npm install
|
||||||
|
working-directory: node_modules/ng_client/
|
||||||
|
|
||||||
|
# final "cleanup"
|
||||||
|
- name: post job
|
||||||
|
run: |
|
||||||
|
bash -ex ./scripts/link_modules_resources.sh
|
||||||
|
bash -ex ./scripts/compile_translations.sh
|
||||||
|
|
||||||
|
# prepare release
|
||||||
|
- name: Get repository name
|
||||||
|
id: repository
|
||||||
|
run: echo "::set-output name=pathref::$(echo '${{ github.repository }}' | cut -d'/' -f2)-$(echo '${{ github.ref_name }}' | sed 's/[^[:alnum:]\.-]/_/g')"
|
||||||
|
|
||||||
|
- name: create artifact archive
|
||||||
|
run: |
|
||||||
|
tar --exclude .git --exclude .github -zcf '../${{ steps.repository.outputs.pathref }}.tar.gz' .
|
||||||
|
|
||||||
|
- name: release
|
||||||
|
uses: softprops/action-gh-release@v1
|
||||||
|
with:
|
||||||
|
files: |
|
||||||
|
../${{ steps.repository.outputs.pathref }}.tar.gz
|
||||||
|
fail_on_unmatched_files: true
|
||||||
|
if: startsWith(github.ref, 'refs/tags/')
|
|
@ -9,53 +9,53 @@ forceClearCache=0
|
||||||
isDevEnv=0
|
isDevEnv=0
|
||||||
while getopts "hbcd" option
|
while getopts "hbcd" option
|
||||||
do
|
do
|
||||||
case $option in
|
case $option in
|
||||||
h)
|
h)
|
||||||
echo -e "Update or install all Monarc modules, frontend views and migrate database."
|
echo -e "Update or install all Monarc modules, frontend views and migrate database."
|
||||||
echo -e "\t-b\tbypass migrate database"
|
echo -e "\t-b\tbypass migrate database"
|
||||||
echo -e "\t-c\tforce clear cache"
|
echo -e "\t-c\tforce clear cache"
|
||||||
echo -e "\t-h\tdisplay this message"
|
echo -e "\t-h\tdisplay this message"
|
||||||
exit 1
|
exit 1
|
||||||
;;
|
;;
|
||||||
b)
|
b)
|
||||||
bypass=1
|
bypass=1
|
||||||
echo "Migrate database don't execute !!!"
|
echo "Migrate database don't execute !!!"
|
||||||
;;
|
;;
|
||||||
c)
|
c)
|
||||||
forceClearCache=1
|
forceClearCache=1
|
||||||
;;
|
;;
|
||||||
d)
|
d)
|
||||||
isDevEnv=1
|
isDevEnv=1
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
checkout_to_latest_tag() {
|
checkout_to_latest_tag() {
|
||||||
if [ -d $1 ]; then
|
if [ -d $1 ]; then
|
||||||
pushd $1
|
pushd $1
|
||||||
git fetch --tags
|
git fetch --tags
|
||||||
tag=$(git describe --tags `git rev-list --tags --max-count=1`)
|
tag=$(git describe --tags `git rev-list --tags --max-count=1`)
|
||||||
git checkout $tag -b $tag
|
git checkout $tag -b $tag
|
||||||
git pull origin $tag
|
git pull origin $tag
|
||||||
popd
|
popd
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
migrate_module() {
|
migrate_module() {
|
||||||
if [[ -d $1 ]]; then
|
if [[ -d $1 ]]; then
|
||||||
php ./vendor/robmorgan/phinx/bin/phinx migrate -c ./$1/migrations/phinx.php
|
php ./vendor/robmorgan/phinx/bin/phinx migrate -c ./$1/migrations/phinx.php
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
if [[ ! -f "config/autoload/local.php" && $bypass -eq 0 ]]; then
|
if [[ ! -f "config/autoload/local.php" && $bypass -eq 0 ]]; then
|
||||||
echo "Configure Monarc (config/autoload/local.php)"
|
echo "Configure Monarc (config/autoload/local.php)"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
git pull
|
git pull
|
||||||
|
|
||||||
if [ $? != 0 ]; then
|
if [ $? != 0 ]; then
|
||||||
echo "A problem occurred while retrieving remote files from repository."
|
echo "A problem occurred while retrieving remote files from repository."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
./scripts/check_composer.sh
|
./scripts/check_composer.sh
|
||||||
|
@ -64,38 +64,38 @@ if [[ $? -eq 1 ]]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ $isDevEnv -eq 0 ]]; then
|
if [[ $isDevEnv -eq 0 ]]; then
|
||||||
composer ins -o --no-dev
|
composer ins -o --no-dev
|
||||||
else
|
else
|
||||||
composer ins
|
composer ins
|
||||||
fi
|
fi
|
||||||
|
|
||||||
pathCore="module/Monarc/Core"
|
pathCore="module/Monarc/Core"
|
||||||
pathFO="module/Monarc/FrontOffice"
|
pathFO="module/Monarc/FrontOffice"
|
||||||
|
|
||||||
if [[ $bypass -eq 0 ]]; then
|
if [[ $bypass -eq 0 ]]; then
|
||||||
if [ -e data/backup/credentialsmysql.cnf ]; then
|
if [ -e data/backup/credentialsmysql.cnf ]; then
|
||||||
backupdir=data/backup/$(date +"%Y%m%d_%H%M%S")
|
backupdir=data/backup/$(date +"%Y%m%d_%H%M%S")
|
||||||
mkdir $backupdir
|
mkdir $backupdir
|
||||||
echo -e "${GREEN}Dumping database to $backupdir...${NC}"
|
echo -e "${GREEN}Dumping database to $backupdir...${NC}"
|
||||||
mysqldump --defaults-file=data/backup/credentialsmysql.cnf --databases monarc_common > $backupdir/dump-common.sql
|
mysqldump --defaults-file=data/backup/credentialsmysql.cnf --databases monarc_common > $backupdir/dump-common.sql
|
||||||
mysqldump --defaults-file=data/backup/credentialsmysql.cnf --databases monarc_cli > $backupdir/dump-cli.sql
|
mysqldump --defaults-file=data/backup/credentialsmysql.cnf --databases monarc_cli > $backupdir/dump-cli.sql
|
||||||
else
|
else
|
||||||
echo -e "${GREEN}Database backup not configured. Skipping.${NC}"
|
echo -e "${GREEN}Database backup not configured. Skipping.${NC}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
migrate_module $pathCore
|
migrate_module $pathCore
|
||||||
migrate_module $pathFO
|
migrate_module $pathFO
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ -d node_modules && -d node_modules/ng_anr ]]; then
|
if [[ -d node_modules && -d node_modules/ng_anr ]]; then
|
||||||
if [[ -d node_modules/ng_anr/.git ]]; then
|
if [[ -d node_modules/ng_anr/.git ]]; then
|
||||||
checkout_to_latest_tag node_modules/ng_client
|
checkout_to_latest_tag node_modules/ng_client
|
||||||
checkout_to_latest_tag node_modules/ng_anr
|
checkout_to_latest_tag node_modules/ng_anr
|
||||||
else
|
else
|
||||||
npm update
|
npm update
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
npm ci
|
npm ci
|
||||||
fi
|
fi
|
||||||
|
|
||||||
cd node_modules/ng_client
|
cd node_modules/ng_client
|
||||||
|
@ -106,19 +106,18 @@ cd ../..
|
||||||
./scripts/compile_translations.sh
|
./scripts/compile_translations.sh
|
||||||
|
|
||||||
if [[ $forceClearCache -eq 1 ]]; then
|
if [[ $forceClearCache -eq 1 ]]; then
|
||||||
# Clear doctrine cache
|
# Clear Laminas cache
|
||||||
# Move to Monarc/Core Module.php
|
php ./public/index.php orm:clear-cache:metadata
|
||||||
php ./public/index.php orm:clear-cache:metadata
|
php ./public/index.php orm:clear-cache:query
|
||||||
php ./public/index.php orm:clear-cache:query
|
php ./public/index.php orm:clear-cache:result
|
||||||
php ./public/index.php orm:clear-cache:result
|
|
||||||
|
|
||||||
# Clear ZF2 cache
|
# Clear Laminas cache
|
||||||
touch ./data/cache/upgrade && chmod 777 ./data/cache/upgrade
|
touch ./data/cache/upgrade && chmod 777 ./data/cache/upgrade
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ $forceClearCache -eq 0 && $bypass -eq 0 ]]; then
|
if [[ $forceClearCache -eq 0 && $bypass -eq 0 ]]; then
|
||||||
# Clear ZF2 cache
|
# Clear Laminas cache
|
||||||
touch ./data/cache/upgrade && chmod 777 ./data/cache/upgrade
|
touch ./data/cache/upgrade && chmod 777 ./data/cache/upgrade
|
||||||
fi
|
fi
|
||||||
|
|
||||||
./scripts/update_config_variables.sh
|
./scripts/update_config_variables.sh
|
||||||
|
|
Loading…
Reference in New Issue