Skip to content

Commit

Permalink
Update github actions flutter workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
pratul committed Jan 24, 2023
1 parent ad0ee45 commit 4aee5aa
Show file tree
Hide file tree
Showing 2 changed files with 80 additions and 81 deletions.
84 changes: 42 additions & 42 deletions templates/workflows/github-flutter-signed
Original file line number Diff line number Diff line change
Expand Up @@ -17,51 +17,51 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v3

- uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: 11
cache: 'gradle'
- uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: 11
cache: 'gradle'

# Setup the flutter environment.
- uses: subosito/flutter-action@v2
with:
channel: 'stable'
cache: true
# Setup the flutter environment.
- uses: subosito/flutter-action@v2
with:
channel: 'stable'
cache: true

# Get flutter dependencies.
- run: flutter pub get
# Get flutter dependencies.
- run: flutter pub get

{% raw -%}
- name: Retrieve secrets
env:
KEYSTORE_B64: ${{ secrets.KEYSTORE_B64 }}
KEY_PROPERTIES_B64: ${{ secrets.KEY_PROPERTIES_B64 }}
run: |
echo $KEYSTORE_B64 | base64 --decode > android/app/ueno-upload-keystore.jks
echo $KEY_PROPERTIES_B64 | base64 --decode > android/key.properties
{%- endraw %}
{% raw -%}
- name: Retrieve secrets
env:
KEYSTORE_B64: ${{ secrets.KEYSTORE_B64 }}
KEY_PROPERTIES_B64: ${{ secrets.KEY_PROPERTIES_B64 }}
run: |
echo $KEYSTORE_B64 | base64 --decode > android/app/ueno-upload-keystore.jks
echo $KEY_PROPERTIES_B64 | base64 --decode > android/key.properties
{%- endraw %}

# Build apk.
{%- let pf %}
{%- match publishing_format %}
{%- when PublishingFormat::Apk %}
{%- let pf = "apk" %}
{%- when PublishingFormat::Aab %}
{%- let pf = "appbundle" %}
{%- endmatch %}
- run: flutter build {{ pf }} --release {% raw -%}--build-number=${{ github.event.inputs.versionCode }} --build-name=${{ github.event.inputs.versionName }}{%- endraw %}
# Build.
{%- let pf %}
{%- match publishing_format %}
{%- when PublishingFormat::Apk %}
{%- let pf = "apk" %}
{%- when PublishingFormat::Aab %}
{%- let pf = "appbundle" %}
{%- endmatch %}
- run: flutter build {{ pf }} --release {% raw -%}--build-number=${{ github.event.inputs.versionCode }} --build-name=${{ github.event.inputs.versionName }}{%- endraw %}

# Upload generated apk to the artifacts.
- uses: actions/upload-artifact@v3
with:
{%- match publishing_format %}
{%- when PublishingFormat::Aab %}
name: release-aab
path: build/app/outputs/bundle/{{ build_variant_path }}.aab
{%- when PublishingFormat::Apk %}
name: release-apk
path: build/app/outputs/apk/{{ build_variant_path }}.apk
{%- endmatch %}
# Upload generated apk to the artifacts.
- uses: actions/upload-artifact@v3
with:
{%- match publishing_format %}
{%- when PublishingFormat::Aab %}
name: release-aab
path: build/app/outputs/bundle/{{ build_variant_path }}.aab
{%- when PublishingFormat::Apk %}
name: release-apk
path: build/app/outputs/apk/{{ build_variant_path }}.apk
{%- endmatch %}
77 changes: 38 additions & 39 deletions templates/workflows/github-flutter-unsigned
Original file line number Diff line number Diff line change
Expand Up @@ -14,45 +14,44 @@ on:

jobs:
build:
# This job will run on ubuntu virtual machine
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: 11
cache: 'gradle'

# Setup the flutter environment.
- uses: subosito/flutter-action@v2
with:
channel: 'stable'
cache: true

# Get flutter dependencies.
- run: flutter pub get

# Build apk.
{%- let pf %}
{%- match publishing_format %}
{%- when PublishingFormat::Apk %}
{%- let pf = "apk" %}
{%- when PublishingFormat::Aab %}
{%- let pf = "appbundle" %}
{%- endmatch %}
- run: flutter build {{ pf }} --debug {% raw %}--build-number=${{ github.event.inputs.versionCode }} --build-name=${{ github.event.inputs.versionName }}{%- endraw %}

# Upload generated apk to the artifacts.
- uses: actions/upload-artifact@v3
with:
{%- match publishing_format %}
{%- when PublishingFormat::Aab %}
name: debug-aab
path: build/app/outputs/bundle/{{ build_variant_path }}.aab
{%- when PublishingFormat::Apk %}
name: debug-apk
path: build/app/outputs/flutter-apk/{{ build_variant_path }}.apk
{%- endmatch %}
- uses: actions/checkout@v3

- uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: 11
cache: 'gradle'

# Setup the flutter environment.
- uses: subosito/flutter-action@v2
with:
channel: 'stable'
cache: true

# Get flutter dependencies.
- run: flutter pub get

# Build.
{%- let pf %}
{%- match publishing_format %}
{%- when PublishingFormat::Apk %}
{%- let pf = "apk" %}
{%- when PublishingFormat::Aab %}
{%- let pf = "appbundle" %}
{%- endmatch %}
- run: flutter build {{ pf }} --debug {% raw %}--build-number=${{ github.event.inputs.versionCode }} --build-name=${{ github.event.inputs.versionName }}{%- endraw %}

# Upload generated apk to the artifacts.
- uses: actions/upload-artifact@v3
with:
{%- match publishing_format %}
{%- when PublishingFormat::Aab %}
name: debug-aab
path: build/app/outputs/bundle/{{ build_variant_path }}.aab
{%- when PublishingFormat::Apk %}
name: debug-apk
path: build/app/outputs/flutter-apk/{{ build_variant_path }}.apk
{%- endmatch %}

0 comments on commit 4aee5aa

Please sign in to comment.