Skip to content
This repository has been archived by the owner on Mar 28, 2024. It is now read-only.

Commit

Permalink
Remove unnecessary workflow logic and add cron job for Flutter upgrades
Browse files Browse the repository at this point in the history
  • Loading branch information
Ziedelth committed Nov 9, 2023
1 parent 831b178 commit a28705f
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 42 deletions.
37 changes: 37 additions & 0 deletions .github/workflows/cron-upgrade.yml
Original file line number Diff line number Diff line change
@@ -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
44 changes: 2 additions & 42 deletions .github/workflows/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ on:
pull_request:

jobs:
# Check if environment is correct
check_env:
name: Check environment
runs-on: ubuntu-latest
Expand Down Expand Up @@ -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:
Expand All @@ -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:
Expand All @@ -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
Expand Down

0 comments on commit a28705f

Please sign in to comment.