Encapsulate Url Launch with Toast (#1005) #263
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
on: | |
push: | |
branches: [master, develop] | |
jobs: | |
bump_version: | |
permissions: | |
actions: "write" | |
name: "Bump pubspec version" | |
runs-on: ubuntu-latest | |
env: | |
APP_VERSION_PATH: "uni/app_version.txt" | |
PUBSPEC_PATH: "uni/pubspec.yaml" | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
token: ${{ secrets.NIAEFEUPBOT_PAT }} | |
- name: Get develop hash | |
if: github.ref == 'refs/heads/master' | |
run: | | |
git fetch origin develop | |
current_hash=$(git rev-parse origin/develop) | |
echo "DEVELOPHASH=$current_hash" >> $GITHUB_ENV | |
- name: Bump flutter patch version | |
if: github.ref == 'refs/heads/develop' || github.sha != env.DEVELOPHASH | |
run: perl -i -pe 's/^(\d+\.\d+\.)(\d+)(\+)(\d+)$/$1.($2+1).($3).($4+1)/e' ${{ env.APP_VERSION_PATH }} | |
- name: Bump flutter minor version | |
if: github.ref == 'refs/heads/master' && github.sha == env.DEVELOPHASH | |
run: perl -i -pe 's/^(\d+)(\.)(\d+)(\.)(\d+)(\+)(\d+)$/$1.($2).($3+1).($4).(0).($6).($7+1)/e' ${{ env.APP_VERSION_PATH }} | |
- name: Copy app version to pubspec | |
run: cat ${{ env.APP_VERSION_PATH }} | perl -i -pe 's/^(version:\s+)(\d+\.\d+\.\d+\+\d+)$/$1.(<STDIN>)/e' ${{ env.PUBSPEC_PATH }} | |
- uses: stefanzweifel/git-auto-commit-action@v4 | |
with: | |
commit_message: "Bump app version [no ci]" | |
- name: Propagate master version bump to develop if master version is aad | |
if: github.ref == 'refs/heads/master' | |
run: | | |
git fetch origin develop | |
if [[ $(git diff --quiet HEAD~1 origin/develop) ]]; then | |
echo "Master version does not match develop version" | |
else | |
echo "Master version matches develop version" | |
git push --force-with-lease origin HEAD:develop | |
fi | |
build: | |
name: "Build App Bundle" | |
runs-on: ubuntu-latest | |
needs: [bump_version] | |
env: | |
PROPERTIES_PATH: "android/key.properties" | |
JAVA_VERSION: "11.x" | |
FLUTTER_VERSION: "3.10.6" | |
defaults: | |
run: | |
working-directory: ./uni | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-java@v3 | |
with: | |
java-version: ${{env.JAVA_VERSION}} | |
distribution: "zulu" | |
- uses: subosito/flutter-action@v2 | |
with: | |
flutter-version: ${{ env.FLUTTER_VERSION }} | |
- name: Download Android keystore | |
run: echo "${{ secrets.ANDROID_KEYSTORE_BASE64 }}" | base64 --decode > /tmp/key.jks | |
- name: Create key.properties | |
run: | | |
rm -f -- ${{env.PROPERTIES_PATH}} | |
touch ${{env.PROPERTIES_PATH}} | |
echo "storeFile=/tmp/key.jks" >> ${{env.PROPERTIES_PATH}} | |
echo "storePassword=${{ secrets.ANDROID_KEYSTORE_PASSWORD }}" >> ${{env.PROPERTIES_PATH}} | |
echo "keyPassword=${{ secrets.ANDROID_KEY_PASSWORD }}" >> ${{env.PROPERTIES_PATH}} | |
echo "keyAlias=${{ secrets.ANDROID_KEY_ALIAS }}" >> ${{env.PROPERTIES_PATH}} | |
- name: Build Android App Bundle | |
run: | | |
flutter pub get | |
flutter build appbundle | |
- name: Upload App Bundle | |
uses: actions/upload-artifact@v3 | |
with: | |
name: appbundle | |
if-no-files-found: error | |
path: uni/build/app/outputs/bundle/release/app-release.aab | |
deploy_play_store: | |
name: "Deploy to Google Play Store" | |
runs-on: ubuntu-latest | |
needs: [build] | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Get App Bundle | |
uses: actions/download-artifact@v3 | |
with: | |
name: appbundle | |
- name: Release app to beta track | |
if: github.ref == 'refs/heads/develop' | |
uses: r0adkll/upload-google-play@v1 | |
with: | |
serviceAccountJsonPlainText: ${{ secrets.GOOGLE_SERVICE_ACCOUNT_JSON }} | |
packageName: ${{ secrets.ANDROID_PACKAGE_NAME }} | |
releaseFiles: app-release.aab | |
whatsNewDirectory: whatsnew | |
track: beta | |
status: completed | |
- name: Release app to production track | |
if: github.ref == 'refs/heads/master' | |
uses: r0adkll/upload-google-play@v1 | |
with: | |
serviceAccountJsonPlainText: ${{ secrets.GOOGLE_SERVICE_ACCOUNT_JSON }} | |
packageName: ${{ secrets.ANDROID_PACKAGE_NAME }} | |
releaseFiles: app-release.aab | |
whatsNewDirectory: whatsnew | |
track: production | |
status: completed |