Skip to content

Commit

Permalink
[gh] restructure workflows to enable develop branch
Browse files Browse the repository at this point in the history
  • Loading branch information
dreautall committed Feb 24, 2024
1 parent f56a022 commit 1f2a69b
Show file tree
Hide file tree
Showing 2 changed files with 69 additions and 37 deletions.
59 changes: 59 additions & 0 deletions .github/workflows/commit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: Check

on:
push:
workflow_call:
inputs:
external_call:
description: 'To distinguish workflow_call from regular push'
type: boolean
required: false
default: true

jobs:
setup_env:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

# Setup the Java environment.
- uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: ${{vars.JAVA_VERSION}}
cache: 'gradle'

# Setup the Flutter environment.
- uses: subosito/flutter-action@v2
with:
channel: ${{vars.FLUTTER_CHANNEL}}
cache: true

# No dart analytics.
- run: dart --disable-analytics

# No flutter analytics.
- run: flutter config --disable-analytics

# Get flutter dependencies.
- run: flutter pub get

analyze:
runs-on: ubuntu-latest
needs: [setup_env]

steps:
# Check for any formatting issues in the code.
- run: dart format --set-exit-if-changed .

# Statically analyze the Dart code for any errors.
- run: dart analyze .

# test:
# runs-on: ubuntu-latest
# needs: [analyze]
#
# steps:
# # Run widget tests for our flutter project.
# - run: flutter test
47 changes: 10 additions & 37 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,34 +2,22 @@ name: Build

on:
release:
types: [created]
types:
- created
push:
branches: [master]
branches:
- develop

env:
JAVA_VERSION: "17.x"
FLUTTER_CHANNEL: "stable"
PROPERTIES_PATH: "./android/key.properties"

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

# Setup Java environment in order to build the Android app.
- uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: ${{env.JAVA_VERSION}}
cache: 'gradle'

# Setup the flutter environment.
- uses: subosito/flutter-action@v2
with:
channel: ${{env.FLUTTER_CHANNEL}}
cache: true
# Call Commit workflow to setup workspace
- uses: ./.github/workflows/commit.yml

# Generate keystore
- uses: timheuer/[email protected]
Expand All @@ -49,24 +37,6 @@ jobs:
- run: |
sed -i 's/^\(version: [0-9\.]\{1,\}\(-[a-z]\{1,\}\)\{0,1\}\)$/\1+${{ github.run_number }}/m' pubspec.yaml
# No dart analytics.
- run: dart --disable-analytics

# No flutter analytics.
- run: flutter config --no-analytics

# Get flutter dependencies.
- run: flutter pub get

# Check for any formatting issues in the code.
- run: dart format --set-exit-if-changed .

# Statically analyze the Dart code for any errors.
- run: dart analyze .

# Run widget tests for our flutter project.
# - run: flutter test

# Build apk.
- run: flutter build apk --obfuscate --split-debug-info=build/app/outputs/symbols/apk --release --split-per-abi

Expand Down Expand Up @@ -108,6 +78,7 @@ jobs:
upload-to-github:
runs-on: ubuntu-latest
needs: [build]
if: startsWith(github.ref, 'refs/tags/')

steps:
- uses: actions/download-artifact@v4
Expand All @@ -124,7 +95,6 @@ jobs:
path: ./artifacts

- uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
files: |
./artifacts/app-arm64-v8a-release.apk
Expand All @@ -148,6 +118,7 @@ jobs:
with:
name: mapping.txt
path: ./artifacts
# not a release --> push to internal
- uses: r0adkll/upload-google-play@v1
if: ${{ !startsWith(github.ref, 'refs/tags/') }}
with:
Expand All @@ -158,6 +129,7 @@ jobs:
mappingFile: ./artifacts/mapping.txt
track: internal
status: completed
# prerelease --> push to beta
- uses: r0adkll/upload-google-play@v1
if: ${{ startsWith(github.ref, 'refs/tags/') && github.event.release.prerelease }}
with:
Expand All @@ -168,6 +140,7 @@ jobs:
mappingFile: ./artifacts/mapping.txt
track: beta
status: completed
# release --> push to production
- uses: r0adkll/upload-google-play@v1
if: ${{ startsWith(github.ref, 'refs/tags/') && !github.event.release.prerelease }}
with:
Expand Down

0 comments on commit 1f2a69b

Please sign in to comment.