From a28705fa46e0b550362e4aa2334197c0abfbf77e Mon Sep 17 00:00:00 2001 From: Ziedelth Date: Thu, 9 Nov 2023 12:45:47 +0100 Subject: [PATCH] Remove unnecessary workflow logic and add cron job for Flutter upgrades --- .github/workflows/cron-upgrade.yml | 37 +++++++++++++++++++++++++ .github/workflows/pipeline.yml | 44 ++---------------------------- 2 files changed, 39 insertions(+), 42 deletions(-) create mode 100644 .github/workflows/cron-upgrade.yml diff --git a/.github/workflows/cron-upgrade.yml b/.github/workflows/cron-upgrade.yml new file mode 100644 index 00000000..1cc4714d --- /dev/null +++ b/.github/workflows/cron-upgrade.yml @@ -0,0 +1,37 @@ +name: Cron upgrade Flutter packages + +on: + schedule: + - cron: "0 10 * * *" + push: + branches: + - master + +jobs: + upgrader: + runs-on: ubuntu-latest + + permissions: + contents: write + pull-requests: write + + steps: + - name: Setup Flutter + uses: subosito/flutter-action@v2 + with: + channel: 'stable' + + - uses: actions/checkout@v4 + - run: flutter pub get + - run: flutter pub upgrade + - uses: peter-evans/create-pull-request@v5 + with: + token: ${{ secrets.REPO_SCOPED_TOKEN }} + commit-message: "Upgrade Flutter packages" + title: "Upgrade Flutter packages" + body: "Upgrade Flutter packages" + branch: upgrade-packages + branch-suffix: timestamp + labels: "dependencies,dart" + signoff: true + delete-branch: true diff --git a/.github/workflows/pipeline.yml b/.github/workflows/pipeline.yml index 562ed117..292c3246 100644 --- a/.github/workflows/pipeline.yml +++ b/.github/workflows/pipeline.yml @@ -4,7 +4,6 @@ on: pull_request: jobs: - # Check if environment is correct check_env: name: Check environment runs-on: ubuntu-latest @@ -45,42 +44,6 @@ jobs: - name: Dart Analyze run: dart analyze . - upgrade: - # If the target branch is 'stable' - if: github.event.pull_request.base.ref == 'stable' - needs: - - validating - name: Flutter Upgrade - runs-on: ubuntu-latest - - permissions: - # Give the default GITHUB_TOKEN write permission to commit and push the - # added or changed files to the repository. - contents: write - - steps: - - name: Setup Flutter - uses: subosito/flutter-action@v2 - with: - channel: 'stable' - - - name: Checkout - uses: actions/checkout@v4 - with: - repository: ${{ github.event.pull_request.head.repo.full_name }} - ref: ${{ github.event.pull_request.head.ref }} - - - name: Get - run: flutter pub get - - - name: Flutter Upgrade - run: flutter pub upgrade - - - uses: stefanzweifel/git-auto-commit-action@v5 - with: - commit_message: Upgrade Flutter - - # Make a job with the title of pull request contains "flutter_native_splash" and only on opened pull request native_splash: if: contains(github.event.pull_request.title, 'flutter_native_splash') && (github.event.action == 'opened' || github.event.action == 'synchronize') needs: @@ -89,8 +52,6 @@ jobs: runs-on: ubuntu-latest permissions: - # Give the default GITHUB_TOKEN write permission to commit and push the - # added or changed files to the repository. contents: write steps: @@ -112,13 +73,12 @@ jobs: run: dart run flutter_native_splash:create - uses: stefanzweifel/git-auto-commit-action@v5 - # Build the app build_android: name: Build Android runs-on: ubuntu-latest - if: ${{ always() }} - needs: [validating, native_splash, upgrade] + needs: + - validating steps: - name: Set up JDK 17