name: Push Pipeline on: push: branches: - "development" - "main" jobs: test: 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.38.6 - name: Get dependencies run: | git config --global --add safe.directory /opt/hostedtoolcache/flutter/stable-3.38.6-x64 flutter pub get - name: Run tests run: flutter test format: 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.38.6 - name: Get dependencies run: | git config --global --add safe.directory /opt/hostedtoolcache/flutter/stable-3.38.6-x64 flutter pub get - 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' env: GITEA_TOKEN: ${{ secrets.BOT_TOKEN }} run: | git fetch origin ${{ gitea.ref_name }} git checkout ${{ gitea.ref_name }} dart fix --apply lib dart fix --apply test if [ -n "$(git status --porcelain lib test)" ]; then git config --global user.name "Gitea Actions [bot]" git config --global user.email "actions@yannick-weigert.de" git add lib test git commit -m "Auto-format code [skip ci]" git push origin HEAD:${{ gitea.ref_name }} else echo "No changes to commit" fi - name: Verify format run: flutter analyze lib test update_version: runs-on: ubuntu-latest needs: format if: gitea.ref == 'refs/heads/development' steps: - name: Checkout code uses: actions/checkout@v4 with: fetch-depth: 0 token: ${{ secrets.BOT_TOKEN }} ref: ${{ gitea.ref_name }} - name: Increment version number uses: https://github.com/stikkyapp/update-pubspec-version@v2 with: strategy: 'patch' path: './pubspec.yaml' - name: Commit version update env: GITEA_TOKEN: ${{ secrets.BOT_TOKEN }} run: | git config --global user.name "Gitea Actions [bot]" git config --global user.email "actions@yannick-weigert.de" git add pubspec.yaml git commit -m "Updated version number [skip ci]" git push origin HEAD:${{ gitea.ref_name }}