Update dart.yml #35
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 CI | |
on: | |
push: | |
branches: [ "main" ] | |
pull_request: | |
branches: [ "main" ] | |
workflow_dispatch: | |
jobs: | |
version: | |
name: Create version number | |
# The type of runner that the job will run on | |
runs-on: ubuntu-latest | |
# Steps represent a sequence of tasks that will be executed as part of the job | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Install GitVersion | |
uses: gittools/actions/gitversion/[email protected] | |
with: | |
versionSpec: "5.x" | |
- name: Use GitVersion | |
id: gitversion | |
uses: gittools/actions/gitversion/[email protected] | |
- name: Create version.txt with nuGetVersion | |
run: echo ${{ steps.gitversion.outputs.nuGetVersion }} > version.txt | |
- name: Upload version.txt | |
uses: actions/upload-artifact@v2 | |
with: | |
name: gitversion | |
path: version.txt | |
build: | |
name: Create Android Build | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
# Downloading version number | |
- name: Get version.txt | |
uses: actions/download-artifact@v2 | |
with: | |
name: gitversion | |
- name: Create new file without newline char from version.txt | |
run: tr -d '\n' < version.txt > version1.txt | |
- name: Read version | |
id: version | |
uses: juliangruber/read-file-action@v1 | |
with: | |
path: version1.txt | |
- name: Update version in YAML | |
run: sed -i 's/99.99.99+99/${{ steps.version.outputs.content }}+${{ github.run_number }}/g' pubspec.yaml | |
# Building | |
- name: Setup java | |
uses: actions/setup-java@v1 | |
with: | |
java-version: '12.x' | |
- name: Setup Flutter | |
uses: subosito/flutter-action@v2 | |
with: | |
flutter-version: "3.3.1" | |
channel: 'stable' | |
- name: Get dependencies | |
run: flutter pub get | |
- name: Build APK | |
run: flutter build apk | |
- name: Upload APK | |
uses: actions/upload-artifact@v4 | |
with: | |
name: gitversion | |
path: build/app/outputs/apk/release/app-release.apk | |
if-no-files-found: error |