try... try... #4
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Flutter Build Apk | |
# This workflow is triggered on pushes to the repository. | |
on: | |
push: | |
branches: | |
- main | |
# on: push # Default will running for every branch. | |
jobs: | |
build: | |
# This job will run on ubuntu virtual machine | |
permissions: write-all | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-deap: 0 | |
- name: Get next version | |
uses: reecetech/[email protected] | |
id: version | |
with: | |
release_branch: main | |
scheme: semver | |
increment: patch | |
- run: echo ${{ steps.version.outputs.version }} | |
- name: Set up JDK 17.0 | |
uses: actions/setup-java@v1 | |
with: | |
java-version: 17.0 | |
- name: Setup Android SDK | |
uses: android-actions/setup-android@v2 | |
- name: Setup Flutter SDK | |
uses: flutter-actions/setup-flutter@v2 | |
with: | |
channel: stable | |
version: 3.19.5 | |
- name: Install dependencies | |
run: flutter pub get | |
- name: Analyze project source | |
run: dart analyze | |
# - name: Run tests | |
# run: flutter test | |
# Build apk. | |
- name: build apk | |
run: flutter build apk | |
- uses: ilharp/sign-android-release@v1 | |
name: Sign app APK | |
id: sign_app | |
with: | |
releaseDir: build/app/outputs/apk/release | |
signingKey: ${{ secrets.KEYSTORE }} | |
keyAlias: ${{ secrets.SIGNING_KEY_ALIAS }} | |
keyStorePassword: ${{ secrets.SIGNING_STORE_PASSWORD }} | |
keyPassword: ${{ secrets.SIGNING_KEY_PASSWORD }} | |
buildToolsVersion: 33.0.0 | |
# Upload generated apk to the artifacts. | |
- name: relase output | |
uses: actions/upload-artifact@v1 | |
with: | |
name: release-apk | |
path: build/app/outputs/apk/release/app-release.apk | |
- name: create-release | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITUB_TOKEN }} | |
with: | |
tag_name: v${{ steps.version.outputs.version }} | |
release_name: Release ${{ steps.version.outputs.version }} | |
draft: true | |
prerelease: false | |
- name: Upload release asset | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: ${{steps.sign_app.outputs.signedFile}} | |
asset_name: reciper-release-${{ steps.version.outputs.version }}.apk | |
asset_content_type: application/apk | |
- name: Publish release | |
uses: eregon/[email protected] | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITUB_TOKEN }} | |
with: | |
release_id: ${{ steps.create_release.outputs.id }} |