From 61aa797a67ff26e87d81b7b02f5e0fb226e516b7 Mon Sep 17 00:00:00 2001 From: x-wei Date: Sun, 9 Jun 2024 14:35:23 +0200 Subject: [PATCH] add workflow to build&deploy web also split the build-io and build-android workflow files --- .github/workflows/build-android.yml | 42 +++++++++++++++++ .../{flutter-actions.yml => build-ios.yml} | 45 ++----------------- .github/workflows/publish-web.yml | 28 ++++++++++++ 3 files changed, 74 insertions(+), 41 deletions(-) create mode 100644 .github/workflows/build-android.yml rename .github/workflows/{flutter-actions.yml => build-ios.yml} (52%) create mode 100644 .github/workflows/publish-web.yml diff --git a/.github/workflows/build-android.yml b/.github/workflows/build-android.yml new file mode 100644 index 0000000..117b1c9 --- /dev/null +++ b/.github/workflows/build-android.yml @@ -0,0 +1,42 @@ +name: build-android + +on: + workflow_dispatch: + +jobs: + build-android-apk: + runs-on: ubuntu-latest + steps: + - name: Clone repository + uses: actions/checkout@v4 + + - name: Cache Flutter + uses: actions/cache@v3 + id: flutter-cache + with: + key: $GITHUB_SHA-flutter + path: ~/.flutter + + - name: Cache Gradle + uses: actions/cache@v3 + id: gradle-cache + with: + key: $GITHUB_SHA-gradle + path: ~/.gradle + + - name: Set up JDK 19 + uses: actions/setup-java@v4 + with: + java-version: "19" + distribution: 'temurin' + cache: "gradle" + + - name: Set up Flutter + uses: subosito/flutter-action@v2 + with: + channel: stable + cache: true + + - run: flutter pub get + + - run: flutter build apk \ No newline at end of file diff --git a/.github/workflows/flutter-actions.yml b/.github/workflows/build-ios.yml similarity index 52% rename from .github/workflows/flutter-actions.yml rename to .github/workflows/build-ios.yml index 445893c..4e6f3ce 100644 --- a/.github/workflows/flutter-actions.yml +++ b/.github/workflows/build-ios.yml @@ -1,46 +1,9 @@ -name: build-app +name: build-ios on: workflow_dispatch: jobs: - build-android: - runs-on: ubuntu-latest - steps: - - name: Clone repository - uses: actions/checkout@v4 - - - name: Cache Flutter - uses: actions/cache@v2 - id: flutter-cache - with: - key: $GITHUB_SHA-flutter - path: ~/.flutter - - - name: Cache Gradle - uses: actions/cache@v2 - id: gradle-cache - with: - key: $GITHUB_SHA-gradle - path: ~/.gradle - - - name: Set up JDK 19 - uses: actions/setup-java@v4 - with: - java-version: "19" - distribution: 'temurin' - cache: "gradle" - - - name: Set up Flutter - uses: subosito/flutter-action@v2 - with: - channel: stable - cache: true - - - run: flutter pub get - - - run: flutter build apk - build-ios: runs-on: macos-latest steps: @@ -48,21 +11,21 @@ jobs: uses: actions/checkout@v4 - name: Cache CocoaPods - uses: actions/cache@v2 + uses: actions/cache@v3 id: cocoa-pods-cache with: key: $GITHUB_SHA-cocoa-pods path: ~/Library/Caches/CocoaPods - name: Cache Xcode Derived Data - uses: actions/cache@v2 + uses: actions/cache@v3 id: xcode-derived-data-cache with: key: $GITHUB_SHA-xcode-derived-data path: ~/Library/Developer/Xcode/DerivedData - name: Cache Flutter - uses: actions/cache@v2 + uses: actions/cache@v3 id: flutter-cache with: key: $GITHUB_SHA-flutter diff --git a/.github/workflows/publish-web.yml b/.github/workflows/publish-web.yml new file mode 100644 index 0000000..009ee0e --- /dev/null +++ b/.github/workflows/publish-web.yml @@ -0,0 +1,28 @@ +name: Publish to Github Pages + +on: + workflow_dispatch: + +jobs: + build-and-deploy-web: + runs-on: ubuntu-latest + steps: + - name: Clone repository + uses: actions/checkout@v4 + - name: Cache Flutter + uses: actions/cache@v3 + id: flutter-cache + with: + key: $GITHUB_SHA-flutter + path: ~/.flutter + - name: Set up Flutter + uses: subosito/flutter-action@v2 + with: + channel: stable + cache: true + # - name: Build and deploy to GH pages + # uses: bluefireteam/flutter-gh-pages@v7 + - run: flutter pub get + - run: flutter build web --release + - name: Deploy to GH pages + uses: peaceiris/actions-gh-pages@v4 \ No newline at end of file