mirror of
https://github.com/KRTirtho/spotube.git
synced 2026-06-20 18:08:04 +00:00
87 lines
2.5 KiB
YAML
87 lines
2.5 KiB
YAML
name: Build and Publish Android
|
|
|
|
on:
|
|
push:
|
|
tags:
|
|
- 'v*'
|
|
workflow_dispatch:
|
|
inputs:
|
|
track:
|
|
description: 'Play store track to deploy to'
|
|
required: false
|
|
default: 'internal'
|
|
|
|
jobs:
|
|
build-and-publish:
|
|
name: Build AAB and publish to Google Play
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Set up Java
|
|
uses: actions/setup-java@v4
|
|
with:
|
|
distribution: 'temurin'
|
|
java-version: '17'
|
|
|
|
- name: Set up Flutter
|
|
uses: subosito/flutter-action@v2
|
|
with:
|
|
channel: 'stable'
|
|
|
|
- name: Install dependencies
|
|
run: flutter pub get
|
|
|
|
- name: Restore keystore (if provided)
|
|
if: secrets.KEYSTORE_BASE64 != ''
|
|
run: |
|
|
echo "$KEYSTORE_BASE64" | base64 --decode > android/key.jks
|
|
echo "storePassword=$KEYSTORE_PASSWORD" > android/key.properties
|
|
echo "keyPassword=$KEY_PASSWORD" >> android/key.properties
|
|
echo "keyAlias=$KEY_ALIAS" >> android/key.properties
|
|
echo "storeFile=key.jks" >> android/key.properties
|
|
env:
|
|
KEYSTORE_BASE64: ${{ secrets.KEYSTORE_BASE64 }}
|
|
KEYSTORE_PASSWORD: ${{ secrets.KEYSTORE_PASSWORD }}
|
|
KEY_PASSWORD: ${{ secrets.KEY_PASSWORD }}
|
|
KEY_ALIAS: ${{ secrets.KEY_ALIAS }}
|
|
|
|
- name: Build AppBundle (stable flavor)
|
|
run: flutter build appbundle --flavor stable --release
|
|
|
|
- name: Find generated AAB
|
|
id: find_aab
|
|
run: |
|
|
echo "Looking for .aab files..."
|
|
aab=$(find build -type f -name "*.aab" | head -n 1)
|
|
echo "aab=$aab" >> $GITHUB_OUTPUT
|
|
|
|
- name: Create GitHub Release
|
|
id: create_release
|
|
uses: actions/create-release@v1
|
|
with:
|
|
tag_name: ${{ github.ref_name }}
|
|
release_name: Release ${{ github.ref_name }}
|
|
body: 'Automated AAB build uploaded by CI'
|
|
draft: false
|
|
prerelease: false
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Upload AAB to Release
|
|
uses: actions/upload-release-asset@v1
|
|
with:
|
|
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
|
asset_path: ${{ steps.find_aab.outputs.aab }}
|
|
asset_name: app-bundle-${{ github.ref_name }}.aab
|
|
asset_content_type: application/octet-stream
|
|
|
|
- name: Upload artifact (AAB)
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: app-bundle
|
|
|
|
path: ${{ steps.find_aab.outputs.aab }}
|