Added sort_arb_files
This commit is contained in:
@@ -71,13 +71,16 @@ jobs:
|
|||||||
update_version:
|
update_version:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
if: gitea.ref == 'refs/heads/development'
|
if: gitea.ref == 'refs/heads/development'
|
||||||
|
env:
|
||||||
|
GITEA_TOKEN: ${{ secrets.BOT_TOKEN }}
|
||||||
|
BRANCH_NAME: ${{ gitea.ref_name }}
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
token: ${{ secrets.BOT_TOKEN }}
|
token: ${GITEA_TOKEN}
|
||||||
ref: ${{ gitea.ref_name }}
|
ref: $BRANCH_NAME
|
||||||
|
|
||||||
- name: Increment version number
|
- name: Increment version number
|
||||||
uses: stikkyapp/update-pubspec-version@v2
|
uses: stikkyapp/update-pubspec-version@v2
|
||||||
@@ -92,10 +95,10 @@ jobs:
|
|||||||
git config --global user.name "Gitea Actions [bot]"
|
git config --global user.name "Gitea Actions [bot]"
|
||||||
git config --global user.email "actions@yannick-weigert.de"
|
git config --global user.email "actions@yannick-weigert.de"
|
||||||
git config pull.rebase false
|
git config pull.rebase false
|
||||||
git pull origin ${{ gitea.ref_name }}
|
git pull origin "$BRANCH_NAME"
|
||||||
git add pubspec.yaml
|
git add pubspec.yaml
|
||||||
git commit -m "Updated version number [skip ci]"
|
git commit -m "Updated version number [skip ci]"
|
||||||
git push origin HEAD:${{ gitea.ref_name }}
|
git push origin HEAD:$BRANCH_NAME
|
||||||
|
|
||||||
generate_licenses:
|
generate_licenses:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
@@ -104,8 +107,8 @@ jobs:
|
|||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
token: ${{ secrets.BOT_TOKEN }}
|
token: $GITEA_TOKEN
|
||||||
ref: ${{ gitea.ref_name }}
|
ref: $BRANCH_NAME
|
||||||
|
|
||||||
# Required for Flutter action
|
# Required for Flutter action
|
||||||
- name: Install jq
|
- name: Install jq
|
||||||
@@ -128,17 +131,15 @@ jobs:
|
|||||||
run: flutter pub run dart_pubspec_licenses:generate -o lib/presentation/views/main_menu/settings_view/licenses/oss_licenses.dart
|
run: flutter pub run dart_pubspec_licenses:generate -o lib/presentation/views/main_menu/settings_view/licenses/oss_licenses.dart
|
||||||
|
|
||||||
- name: Commit license update
|
- name: Commit license update
|
||||||
env:
|
|
||||||
GITEA_TOKEN: ${{ secrets.BOT_TOKEN }}
|
|
||||||
run: |
|
run: |
|
||||||
if [ -n "$(git status --porcelain lib test)" ]; then
|
if [ -n "$(git status --porcelain lib test)" ]; then
|
||||||
git config --global user.name "Gitea Actions [bot]"
|
git config --global user.name "Gitea Actions [bot]"
|
||||||
git config --global user.email "actions@yannick-weigert.de"
|
git config --global user.email "actions@yannick-weigert.de"
|
||||||
git config pull.rebase false
|
git config pull.rebase false
|
||||||
git pull origin ${{ gitea.ref_name }}
|
git pull origin "$BRANCH_NAME"
|
||||||
git add lib test
|
git add lib test
|
||||||
git commit -m "Updated licenses [skip ci]"
|
git commit -m "Updated licenses [skip ci]"
|
||||||
git push origin HEAD:${{ gitea.ref_name }}
|
git push origin HEAD:$BRANCH_NAME
|
||||||
else
|
else
|
||||||
echo "No changes to commit"
|
echo "No changes to commit"
|
||||||
fi
|
fi
|
||||||
@@ -170,7 +171,7 @@ jobs:
|
|||||||
run: flutter gen-l10n --no-use-deferred-loading
|
run: flutter gen-l10n --no-use-deferred-loading
|
||||||
|
|
||||||
- name: Check for changes
|
- name: Check for changes
|
||||||
id: generate_localizations
|
id: check_changes
|
||||||
run: |
|
run: |
|
||||||
if [ -n "$(git status --porcelain lib/l10n)" ]; then
|
if [ -n "$(git status --porcelain lib/l10n)" ]; then
|
||||||
echo "has_changes=true" >> "$GITHUB_OUTPUT"
|
echo "has_changes=true" >> "$GITHUB_OUTPUT"
|
||||||
@@ -179,7 +180,7 @@ jobs:
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
- name: Commit generated localizations
|
- name: Commit generated localizations
|
||||||
if: steps.generate_localizations.outputs.has_changes == 'true'
|
if: steps.check_changes.outputs.has_changes == 'true'
|
||||||
env:
|
env:
|
||||||
GITEA_TOKEN: ${{ secrets.BOT_TOKEN }}
|
GITEA_TOKEN: ${{ secrets.BOT_TOKEN }}
|
||||||
BRANCH_NAME: ${{ gitea.ref_name }}
|
BRANCH_NAME: ${{ gitea.ref_name }}
|
||||||
@@ -199,9 +200,70 @@ jobs:
|
|||||||
echo "No changes to commit"
|
echo "No changes to commit"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
sort_arb_files:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout code
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
# Required for Flutter action
|
||||||
|
- name: Install jq
|
||||||
|
run: |
|
||||||
|
apt-get update
|
||||||
|
apt-get install -y jq
|
||||||
|
|
||||||
|
- name: Set up Flutter
|
||||||
|
uses: subosito/flutter-action@v2
|
||||||
|
with:
|
||||||
|
channel: stable
|
||||||
|
flutter-version: 3.41.0
|
||||||
|
|
||||||
|
- name: Get dependencies
|
||||||
|
run: |
|
||||||
|
git config --global --add safe.directory /opt/hostedtoolcache/flutter/stable-3.41.0-x64
|
||||||
|
flutter pub get
|
||||||
|
|
||||||
|
- name: Sort .arb-Files
|
||||||
|
run: |
|
||||||
|
shopt -s nullglob
|
||||||
|
for file in lib/l10n/arb/app_*.arb; do
|
||||||
|
echo "Sorting $file"
|
||||||
|
dart run arb_utils sort "$file"
|
||||||
|
done
|
||||||
|
|
||||||
|
- name: Check for changes
|
||||||
|
id: check_changes
|
||||||
|
run: |
|
||||||
|
if [ -n "$(git status --porcelain lib/l10n/arb)" ]; then
|
||||||
|
echo "has_changes=true" >> "$GITHUB_OUTPUT"
|
||||||
|
else
|
||||||
|
echo "has_changes=false" >> "$GITHUB_OUTPUT"
|
||||||
|
fi
|
||||||
|
|
||||||
|
- name: Commit sorted .arb-Files
|
||||||
|
if: steps.check_changes.outputs.has_changes == 'true'
|
||||||
|
env:
|
||||||
|
GITEA_TOKEN: ${{ secrets.BOT_TOKEN }}
|
||||||
|
BRANCH_NAME: ${{ gitea.ref_name }}
|
||||||
|
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
|
||||||
|
|
||||||
format:
|
format:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs: [update_version, generate_licenses, generate_localizations]
|
needs: [update_version, generate_licenses, generate_localizations, sort_arb_files]
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
@@ -232,9 +294,10 @@ jobs:
|
|||||||
if: steps.check_format.outcome == 'failure'
|
if: steps.check_format.outcome == 'failure'
|
||||||
env:
|
env:
|
||||||
GITEA_TOKEN: ${{ secrets.BOT_TOKEN }}
|
GITEA_TOKEN: ${{ secrets.BOT_TOKEN }}
|
||||||
|
BRANCH_NAME: ${{ gitea.ref_name }}
|
||||||
run: |
|
run: |
|
||||||
git fetch origin ${{ gitea.ref_name }}
|
git fetch origin "$BRANCH_NAME"
|
||||||
git checkout ${{ gitea.ref_name }}
|
git checkout "$BRANCH_NAME"
|
||||||
|
|
||||||
dart fix --apply lib
|
dart fix --apply lib
|
||||||
dart fix --apply test
|
dart fix --apply test
|
||||||
@@ -243,10 +306,10 @@ jobs:
|
|||||||
git config --global user.name "Gitea Actions [bot]"
|
git config --global user.name "Gitea Actions [bot]"
|
||||||
git config --global user.email "actions@yannick-weigert.de"
|
git config --global user.email "actions@yannick-weigert.de"
|
||||||
git config pull.rebase false
|
git config pull.rebase false
|
||||||
git pull origin ${{ gitea.ref_name }}
|
git pull origin "$BRANCH_NAME"
|
||||||
git add lib test
|
git add lib test
|
||||||
git commit -m "Auto-format code [skip ci]"
|
git commit -m "Auto-format code [skip ci]"
|
||||||
git push origin HEAD:${{ gitea.ref_name }}
|
git push origin HEAD:$BRANCH_NAME
|
||||||
else
|
else
|
||||||
echo "No changes to commit"
|
echo "No changes to commit"
|
||||||
fi
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user