feat: user profile picture #155
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
# Academia Build and release | |
# Build action borrowed from | |
# https://medium.com/@colonal/automating-flutter-builds-and-releases-with-github-actions-77ccf4a1ccdd | |
name: "Academia Build & Release" | |
on: | |
pull_request: | |
branches: | |
- master | |
- dev | |
push: | |
branches: | |
- master | |
- dev | |
jobs: | |
build: | |
name: Build & Release | |
runs-on: ubuntu-latest # For iOS builds | |
strategy: | |
matrix: | |
flavor: [development, staging, production] | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v3 | |
- name: Set Up Java | |
uses: actions/setup-java@v3.12.0 | |
with: | |
distribution: 'oracle' | |
java-version: '21' | |
- name: Set Up Flutter | |
uses: subosito/flutter-action@v2 | |
with: | |
flutter-version: '3.29.0' | |
channel: 'stable' | |
- name: Install Dependencies | |
run: flutter pub get | |
- name: Decode Keystore | |
run: | | |
echo "${{ secrets.KEYSTORE_BASE64 }}" | base64 --decode > android/app/keystore.jks | |
- name: Create key.properties | |
run: | | |
echo "storePassword=${{ secrets.KEYSTORE_PASSWORD }}" > android/key.properties | |
echo "keyPassword=${{ secrets.KEY_PASSWORD }}" >> android/key.properties | |
echo "keyAlias=${{ secrets.KEY_ALIAS }}" >> android/key.properties | |
echo "storeFile=keystore.jks" >> android/key.properties | |
- name: Build APK | |
run: flutter build apk --flavor ${{ matrix.flavor }} --release --target lib/main_${{ matrix.flavor }}.dart | |
- name: Build appBundle | |
run: flutter build appbundle --flavor ${{ matrix.flavor }} --release --target lib/main_${{ matrix.flavor }}.dart | |
- name: Upload Artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: Releases-${{ matrix.flavor }} | |
path: | | |
build/app/outputs/flutter-apk/app-${{ matrix.flavor }}-release.apk | |
build/app/outputs/bundle/${{ matrix.flavor }}/release/app-${{ matrix.flavor }}-release.aab | |
- name: Extract version from pubspec.yaml | |
id: extract_version | |
run: | | |
version=$(grep '^version: ' pubspec.yaml | cut -d ' ' -f 2 | tr -d '\r') | |
echo "VERSION=$version" >> $GITHUB_ENV | |
- name: Check if Tag Exists | |
id: check_tag | |
run: | | |
if git rev-parse "v${{ env.VERSION }}-${{ matrix.flavor }}" >/dev/null 2>&1; then | |
echo "TAG_EXISTS=true" >> $GITHUB_ENV | |
else | |
echo "TAG_EXISTS=false" >> $GITHUB_ENV | |
fi | |
- name: Modify Tag | |
if: env.TAG_EXISTS == 'true' | |
id: modify_tag | |
run: | | |
new_version="${{ env.VERSION }}-${{ matrix.flavor }}-build-${{ github.run_number }}" | |
echo "VERSION=$new_version" >> $GITHUB_ENV | |
- name: Create Release | |
uses: ncipollo/release-action@v1 | |
with: | |
artifacts: "build/app/outputs/flutter-apk/app-${{ matrix.flavor }}-release.apk,build/app/outputs/bundle/${{ matrix.flavor }}/release/app-${{ matrix.flavor }}-release.aab" | |
tag: v${{ env.VERSION }}-${{ matrix.flavor }} | |
token: ${{ secrets.TOKEN }} | |