Test database pipeline
This commit is contained in:
@@ -101,7 +101,7 @@ jobs:
|
|||||||
|
|
||||||
echo "All messages translated."
|
echo "All messages translated."
|
||||||
|
|
||||||
sort_arb_files:
|
database_files:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
@@ -124,40 +124,15 @@ jobs:
|
|||||||
git config --global --add safe.directory /opt/hostedtoolcache/flutter/stable-3.41.0-x64
|
git config --global --add safe.directory /opt/hostedtoolcache/flutter/stable-3.41.0-x64
|
||||||
flutter pub get
|
flutter pub get
|
||||||
|
|
||||||
- name: Sort .arb-Files
|
- name: Check for generated database files
|
||||||
run: |
|
run: |
|
||||||
shopt -s nullglob
|
dart run build_runner build --delete-conflicting-outputs
|
||||||
for file in lib/l10n/arb/app_*.arb; do
|
|
||||||
echo "Sorting $file"
|
|
||||||
dart run arb_utils sort "$file"
|
|
||||||
done
|
|
||||||
|
|
||||||
- name: Check for changes
|
if [ -n "$(git status --porcelain '*.g.dart')" ]; then
|
||||||
id: check_changes
|
echo "Generated database files are out of date. Diff:"
|
||||||
run: |
|
git --no-pager diff -- '*.g.dart'
|
||||||
if [ -n "$(git status --porcelain lib/l10n/arb)" ]; then
|
exit 1
|
||||||
echo "has_changes=true" >> "$GITHUB_OUTPUT"
|
|
||||||
else
|
|
||||||
echo "has_changes=false" >> "$GITHUB_OUTPUT"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
- name: Commit sorted .arb-Files
|
echo "Generated database files are up to date."
|
||||||
if: steps.check_changes.outputs.has_changes == 'true'
|
|
||||||
env:
|
|
||||||
GITEA_TOKEN: ${{ secrets.BOT_TOKEN }}
|
|
||||||
BRANCH_NAME: ${{ gitea.head_ref }}
|
|
||||||
run: |
|
|
||||||
git fetch origin "$BRANCH_NAME"
|
|
||||||
git checkout "$BRANCH_NAME"
|
|
||||||
|
|
||||||
if [ -n "$(git status --porcelain lib/l10n/arb)" ]; then
|
|
||||||
git config --global user.name "Gitea Actions [bot]"
|
|
||||||
git config --global user.email "actions@yannick-weigert.de"
|
|
||||||
git config pull.rebase false
|
|
||||||
git pull origin "$BRANCH_NAME"
|
|
||||||
git add lib/l10n/arb
|
|
||||||
git commit -m "Sort .arb files [skip ci]"
|
|
||||||
git push origin "HEAD:$BRANCH_NAME"
|
|
||||||
else
|
|
||||||
echo "No changes to commit"
|
|
||||||
fi
|
|
||||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user