-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
03d1670
commit 60c111a
Showing
4 changed files
with
146 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,119 @@ | ||
name: Update dcstore.xml file if necessary | ||
|
||
on: | ||
release: | ||
types: | ||
- released | ||
workflow_dispatch: | ||
|
||
# A workflow run is made up of one or more jobs that can run sequentially or in parallel | ||
jobs: | ||
# This workflow contains a single job called "dcstore" | ||
dcstore: | ||
# The type of runner that the job will run on | ||
runs-on: ubuntu-latest | ||
|
||
# Steps represent a sequence of tasks that will be executed as part of the job | ||
steps: | ||
# Setup PHP | ||
- name: Setup PHP | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: '8.0' | ||
|
||
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it | ||
- uses: actions/checkout@v2 | ||
|
||
# Back to default branche | ||
- name: Back to default branch of repository | ||
shell: bash | ||
run: | | ||
echo "git fetch && git switch ${{github.event.repository.default_branch}}" | ||
git fetch | ||
git switch ${{github.event.repository.default_branch}} | ||
# Run PHP code | ||
- name: Run PHP code | ||
id: getversion | ||
shell: php {0} | ||
run: | | ||
<?php | ||
$version = ''; | ||
$dcmin = '2.0'; | ||
if (file_exists('dcstore.xml')) { | ||
$df = file_get_contents('./_define.php'); | ||
if (preg_match('/registerModule\((.*?),(.*?)[\'\"],(.*?)[\'\"],(.*?)[\'\"](.*?)[\'\"](.*?)(,.*)\)/s',$df,$matches)) { | ||
if (isset($matches[5])) { | ||
$version = $matches[5]; | ||
if (isset($matches[7])) { | ||
$str = $matches[7]; | ||
if (preg_match('/\[(.*?)[\'\"]core[\'\"](.*?),(.*?)[\'\"](.*?)[\'\"](.*?)\]/s',$str,$submatches)) { | ||
$dcmin = $submatches[4]; | ||
} | ||
} | ||
} | ||
} | ||
if ($version !== '') { | ||
$ds = file_get_contents('dcstore.xml'); | ||
if ($ds) { | ||
$ds = preg_replace('/<version>(.*?)<\/version>/s',"<version>$version</version>",$ds); | ||
$ds = preg_replace('/download\/(.*?)\//s',"download/$version/",$ds); | ||
$ds = preg_replace('/(.*)-(.*?).zip/s',"$1-$version.zip",$ds); | ||
$ds = preg_replace('/<da:dcmin>(.*?)<\/da:dcmin>/s',"<da:dcmin>$dcmin</da:dcmin>",$ds); | ||
if ($ds) { | ||
file_put_contents('dcstore.xml',$ds); | ||
} | ||
} | ||
} | ||
} | ||
echo "::set-output name=module_version::$version\n"; | ||
echo "::set-output name=module_dcmin::$dcmin\n"; | ||
# Cope with returned versions | ||
- name: Log output of the script | ||
shell: bash | ||
run: echo "${{steps.getversion.outputs.module_version}} (Dotclear ${{steps.getversion.outputs.module_dcmin}}+)" | ||
|
||
# Log default branch | ||
- name: Log output the default branch | ||
shell: bash | ||
run: echo "The default branch is ${{github.event.repository.default_branch}}" | ||
|
||
# Update dcstore.xml if necessary | ||
- name: Update dcstore | ||
id: update-dcstore | ||
shell: bash | ||
run: | | ||
cat dcstore.xml | ||
test=$(git diff --name-only -- dcstore.xml) | ||
if [[ "$test" != "" ]]; then | ||
echo "dcstore.xml modified, need to be commit" | ||
echo "set credentials" | ||
git config user.email "[email protected]" | ||
git config user.name "franck-paul" | ||
echo "git add dcstore.xml" | ||
git add dcstore.xml | ||
echo "git commit" | ||
git commit -m "Update dcstore.xml - version ${{steps.getversion.outputs.module_version}} - Dotclear ${{steps.getversion.outputs.module_dcmin}}+" | ||
echo "git push" | ||
git push | ||
else | ||
echo "nothing to do" | ||
fi | ||
# Notification via Telegram | ||
- name: Send Telegram Message Ok | ||
uses: appleboy/telegram-action@master | ||
env: | ||
GITHUB_CONTEXT: ${{toJSON(github)}} | ||
with: | ||
to: ${{ secrets.TELEGRAM_ID }} | ||
token: ${{ secrets.TELEGRAM_TOKEN }} | ||
format: markdown | ||
message: | | ||
→ Update *dcstore.xml* file if necessary | ||
Version: *${{steps.getversion.outputs.module_version}}* (Dotclear ${{steps.getversion.outputs.module_dcmin}}+) | ||
Branch: *${{ github.ref }}* | ||
Repository: *${{github.repository}}* | ||
Owner: *${{github.repository_owner}}* | ||
🍺 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,10 +8,11 @@ | |
* @copyright Franck Paul ([email protected]) | ||
* @copyright GPL-2.0 | ||
*/ | ||
|
||
namespace themes\cafe_creme; | ||
|
||
if (!defined('DC_RC_PATH')) { | ||
return; | ||
} | ||
|
||
\l10n::set(dirname(__FILE__) . '/locales/' . $_lang . '/main'); | ||
\l10n::set(__DIR__ . '/locales/' . \dcCore::app()->lang . '/main'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?php | ||
/** | ||
* @package Dotclear | ||
* | ||
* @copyright Olivier Meunier & Association Dotclear | ||
* @copyright GPL-2.0-only | ||
*/ | ||
# | ||
# DOT NOT MODIFY THIS FILE ! | ||
# | ||
|
||
l10n::$locales['previous entry'] = 'billet plus ancien'; | ||
l10n::$locales['next entry'] = 'billet plus récent'; | ||
l10n::$locales['All tags'] = 'Tous les mots-clés'; | ||
l10n::$locales['Tags'] = 'Mots-clés'; | ||
l10n::$locales['Tag'] = 'Mot-clé'; |