Workflows um Format Stage erweitern #175
@@ -7,9 +7,9 @@ on:
|
|||||||
- "main"
|
- "main"
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
format:
|
Format:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
if: false # Needs bot user
|
if: false
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
@@ -21,30 +21,65 @@ jobs:
|
|||||||
|
|
||||||
- name: Install Flutter (wget)
|
- name: Install Flutter (wget)
|
||||||
run: |
|
run: |
|
||||||
wget https://storage.googleapis.com/flutter_infra_release/releases/stable/linux/flutter_linux_3.38.2-stable.tar.xz
|
wget --progress=dot:giga https://storage.googleapis.com/flutter_infra_release/releases/stable/linux/flutter_linux_3.38.2-stable.tar.xz
|
||||||
tar xf flutter_linux_3.38.2-stable.tar.xz
|
tar xf flutter_linux_3.38.2-stable.tar.xz
|
||||||
# Set Git safe directory for Flutter path
|
# Set Git safe directory for Flutter path
|
||||||
git config --global --add safe.directory "$(pwd)/flutter"
|
git config --global --add safe.directory "$(pwd)/flutter"
|
||||||
# Set Flutter path
|
# Set Flutter path
|
||||||
echo "$(pwd)/flutter/bin" >> $GITHUB_PATH
|
echo "$(pwd)/flutter/bin" >> $GITHUB_PATH
|
||||||
|
|
||||||
- name: Get & upgrade dependencies
|
- name: Get dependencies
|
||||||
run: |
|
run: flutter pub get
|
||||||
flutter pub get
|
|
||||||
flutter pub upgrade --major-versions
|
|
||||||
|
|
||||||
- name: Auto-format
|
- name: Check code format
|
||||||
|
id: check_format
|
||||||
|
continue-on-error: true
|
||||||
|
run: flutter analyze lib test
|
||||||
|
|
||||||
|
- name: Format code
|
||||||
|
if: steps.check_format.outcome == 'failure'
|
||||||
run: |
|
run: |
|
||||||
dart format lib
|
git fetch origin ${{ gitea.head_ref }}
|
||||||
|
git checkout ${{ gitea.head_ref }}
|
||||||
|
|
||||||
dart fix --apply lib
|
dart fix --apply lib
|
||||||
|
sneeex marked this conversation as resolved
Outdated
|
|||||||
|
dart fix --apply test
|
||||||
|
|
||||||
# Needs credentials, push access and the right files need to be staged
|
if [ -n "$(git status --porcelain lib test)" ]; then
|
||||||
- name: Commit Changes
|
git config --global user.name "Gitea Actions [bot]"
|
||||||
run: |
|
|
||||||
git config --global user.name "Gitea Actions"
|
|
||||||
git config --global user.email "actions@gitea.com"
|
git config --global user.email "actions@gitea.com"
|
||||||
git status
|
git add lib test
|
||||||
git add lib/
|
git commit -m "Auto-format code"
|
||||||
git status
|
git push
|
||||||
git commit -m "Actions: Auto-formatting [skip ci]"
|
else
|
||||||
|
echo "No changes to commit"
|
||||||
|
fi
|
||||||
|
|
||||||
|
- name: Verify format
|
||||||
|
run: flutter analyze lib test
|
||||||
|
|
||||||
|
|
||||||
|
Update Version:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout code
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
|
- name: Update version
|
||||||
|
uses: https://github.com/stikkyapp/update-pubspec-version@v2
|
||||||
|
with:
|
||||||
|
strategy: 'minor'
|
||||||
|
path: './pubspec.yaml'
|
||||||
|
|
||||||
|
- name: Commit version update
|
||||||
|
run: |
|
||||||
|
git fetch origin ${{ gitea.head_ref }}
|
||||||
|
git checkout ${{ gitea.head_ref }}
|
||||||
|
|
||||||
|
git config --global user.name "Gitea Actions [bot]"
|
||||||
|
git config --global user.email "actions@gitea.com"
|
||||||
|
git add pubspec.yaml
|
||||||
|
git commit -m "Updated version number"
|
||||||
git push
|
git push
|
||||||
Reference in New Issue
Block a user
wofür brauchst du jq? gemini sagt ist unnötig
Das war schon vorher drin, und das hatte ohne nicht funktioniert. Ich kann gleich nochmal prüfen