From cabc50d2aab3e7d863c650bba86bfffe27b79cad Mon Sep 17 00:00:00 2001 From: Vadim Date: Tue, 15 Aug 2023 20:23:13 +0200 Subject: [PATCH] Added workflow checks --- .github/workflows/build_apk.yml | 14 ++++++++++++-- .github/workflows/create_release.yml | 15 +++++++++++++-- .github/workflows/pr_check.yml | 25 ++++++++++++++++--------- pubspec.yaml | 4 ++++ 4 files changed, 45 insertions(+), 13 deletions(-) diff --git a/.github/workflows/build_apk.yml b/.github/workflows/build_apk.yml index 12749a9..d7affd4 100644 --- a/.github/workflows/build_apk.yml +++ b/.github/workflows/build_apk.yml @@ -16,17 +16,27 @@ on: - dev - prod default: 'dev' + include-iap: + type: boolean + description: Include IAP package + default: false # TODO(@vodemn) when Google fixes their api jobs: build: name: Build .apk runs-on: macos-11 timeout-minutes: 15 - steps: - - uses: webfactory/ssh-agent@v0.8.0 + - name: Connect private iap package + uses: webfactory/ssh-agent@v0.8.0 + if: ${{ inputs.include-iap }} with: ssh-private-key: ${{ secrets.M3_LIGHTMETER_IAP_KEY }} + + - name: Override iap package with stub + if: ${{ !inputs.include-iap }} + run: | + echo "\ndependecies_override:\n m3_lightmeter_iap:\n path: iap" >> pubspec.yaml - uses: actions/checkout@v3 with: diff --git a/.github/workflows/create_release.yml b/.github/workflows/create_release.yml index 53a7516..d4d912d 100644 --- a/.github/workflows/create_release.yml +++ b/.github/workflows/create_release.yml @@ -31,6 +31,10 @@ on: type: boolean description: Create Google Play release default: true + include-iap: + type: boolean + description: Include IAP package + default: false # TODO(@vodemn) when Google fixes their api env: BUILD_ARGS: --release --flavor prod --dart-define cameraPreviewAspectRatio=240/320 -t lib/main_prod.dart @@ -38,14 +42,21 @@ env: jobs: build: name: Build .apk & .aab - if: ${{ inputs.github-release }} || ${{ inputs.google-play-release }} + if: ${{ inputs.github-release || inputs.google-play-release }} runs-on: macos-11 timeout-minutes: 30 steps: - - uses: webfactory/ssh-agent@v0.8.0 + - name: Connect private iap package + uses: webfactory/ssh-agent@v0.8.0 + if: ${{ inputs.include-iap }} with: ssh-private-key: ${{ secrets.M3_LIGHTMETER_IAP_KEY }} + - name: Override iap package with stub + if: ${{ !inputs.include-iap }} + run: | + echo "\ndependecies_override:\n m3_lightmeter_iap:\n path: iap" >> pubspec.yaml + - uses: actions/checkout@v3 with: submodules: recursive diff --git a/.github/workflows/pr_check.yml b/.github/workflows/pr_check.yml index d85cd9e..537cf64 100644 --- a/.github/workflows/pr_check.yml +++ b/.github/workflows/pr_check.yml @@ -11,20 +11,27 @@ on: pull_request: branches: ["main"] +env: + # Stub iap package if this worlflow is running from the PR from a fork + STUB_IAP: ${{ github.event.pull_request.head.repo.full_name != github.repository }} + jobs: analyze_and_test: name: Analyze & test runs-on: macos-11 timeout-minutes: 10 - steps: - - uses: shaunco/ssh-agent@git-repo-mapping + - name: Connect private iap package + uses: webfactory/ssh-agent@v0.8.0 + if: !env.STUB_IAP with: - ssh-private-key: | - ${{ secrets.M3_LIGHTMETER_IAP_KEY }} - repo-mappings: | - github.com/vodemn/m3_lightmeter_iap - + ssh-private-key: ${{ secrets.M3_LIGHTMETER_IAP_KEY }} + + - name: Override iap package with stub + if: env.STUB_IAP + run: | + echo "\ndependecies_override:\n m3_lightmeter_iap:\n path: iap" >> pubspec.yaml + - uses: actions/checkout@v3 with: submodules: recursive @@ -32,7 +39,7 @@ jobs: - uses: subosito/flutter-action@v2 with: channel: "stable" - flutter-version: '3.10.0' + flutter-version: "3.10.0" - name: Prepare flutter project run: | @@ -44,4 +51,4 @@ jobs: run: flutter analyze lib --fatal-infos - name: Run tests - run: flutter test \ No newline at end of file + run: flutter test diff --git a/pubspec.yaml b/pubspec.yaml index 80baa21..c1b3e11 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -57,3 +57,7 @@ flutter: flutter_intl: enabled: true + +dependecies_override: + m3_lightmeter_iap: + path: iap