readme updated #3
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: Build & Release | |
on: | |
push: | |
branches: | |
- main | |
permissions: | |
contents: write | |
jobs: | |
build: | |
name: Build and Release new apk | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v2 | |
with: | |
distribution: "zulu" | |
java-version: "17" | |
- name: Set up Flutter | |
uses: subosito/flutter-action@v2 | |
with: | |
flutter-version: "3.19.1" # Replace with your desired Flutter version | |
- name: Install dependencies | |
run: flutter pub get | |
- name: Increment version | |
id: increment_version | |
run: | | |
version=$(yq eval '.version' pubspec.yaml) | |
major=$(echo $version | cut -d'.' -f1) | |
minor=$(echo $version | cut -d'.' -f2) | |
patch=$(echo $version | cut -d'.' -f3) | |
new_version="$major.$minor.$((patch))" | |
echo "new_version=$new_version" >> $GITHUB_ENV | |
sed -i "s/^version:.*$/version: $new_version/" pubspec.yaml | |
- name: Build APK | |
run: flutter build apk --release --split-per-abi --no-tree-shake-icons | |
- name: Push to Releases | |
uses: ncipollo/release-action@v1 | |
with: | |
artifacts: "build/app/outputs/apk/release/*" | |
tag: v${{ env.new_version }} | |
token: ${{ secrets.GITHUB_TOKEN }} |