v1.4.5 #41
Workflow file for this run
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 all on release | |
on: | |
release: | |
types: [published] | |
jobs: | |
build_android: | |
name: Build for Android | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v4 | |
- name: Setup Java | |
uses: actions/setup-java@v3.9.0 | |
with: | |
distribution: "zulu" | |
java-version: "11" | |
- name: Setup Flutter | |
uses: subosito/flutter-action@v2.8.0 | |
with: | |
channel: "stable" | |
# File can be encoded to base64 on https://base64.guru/converter/encode/file | |
- name: Decoding android/key.properties | |
run: echo "${{ secrets.KEY_PROP }}" | base64 --decode > android/key.properties | |
- name: Decoding android/key.jks | |
run: echo "${{ secrets.KEY_JKS }}" | base64 --decode > android/key.jks | |
- name: Build release appbundle | |
if: "!github.event.release.prerelease" | |
run: flutter build appbundle | |
- name: Upload aab | |
uses: actions/upload-artifact@v3 | |
if: "!github.event.release.prerelease" | |
with: | |
name: aab artifact | |
path: build/app/outputs/bundle/release/app-release.aab | |
- name: Adding markdown | |
if: "!github.event.release.prerelease" | |
run: | | |
echo :white_check_mark: Build appbundle **todo: Publish to Google Play** >> $GITHUB_STEP_SUMMARY | |
- name: Build release APK(s) | |
run: | | |
flutter pub get | |
flutter build apk --split-per-abi -v | |
- name: Adding markdown | |
run: | | |
echo ":white_check_mark: Build split apk" >> $GITHUB_STEP_SUMMARY | |
- name: Upload file to artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: apks artifact | |
path: build/app/outputs/apk/release/*.apk | |
- name: Adding markdown | |
run: | | |
echo ":rocket: Added release apk(s) to assets" >> $GITHUB_STEP_SUMMARY | |
echo "" >> $GITHUB_STEP_SUMMARY | |
echo ":blue_heart: Using **`flutter --version`**" >> $GITHUB_STEP_SUMMARY | |
build_windows: | |
name: Build for Windows | |
runs-on: windows-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup Flutter | |
uses: subosito/flutter-action@v2.8.0 | |
with: | |
channel: "stable" | |
- name: Flutter build for Windows | |
run: | | |
flutter pub get | |
flutter build windows | |
- name: Add vcredist files tp Release | |
run: | | |
git clone https://github.com/iiumschedule/vcredist.git windows-x64-vc | |
Copy-Item windows-x64-vc/msvcp140.dll build/windows/x64/runner/Release/ | |
Copy-Item windows-x64-vc/vcruntime140.dll build/windows/x64/runner/Release/ | |
Copy-Item windows-x64-vc/vcruntime140_1.dll build/windows/x64/runner/Release/ | |
# package the executable using Inno Setup | |
- name: Building the installer (Inno) | |
run: | | |
"%programfiles(x86)%\Inno Setup 6\iscc.exe" "Inno\setup-script.iss" | |
shell: cmd | |
# Upload the exe to artifacts | |
- name: Upload artifact (.exe) | |
uses: actions/upload-artifact@v3 | |
with: | |
name: windows installer exe | |
path: Inno/iiumschedulesetup.exe | |
- name: Adding markdown | |
run: | | |
echo :white_check_mark: Packaged into .exe file >> $GITHUB_STEP_SUMMARY | |
# skip MSIX packaging if it's a pre-release | |
- name: Decoding CERTIFICATE.pfx | |
if: "!github.event.release.prerelease" | |
shell: cmd | |
# certutil [options] -decode infile outfile | |
# Read cert base64 from env secrets, write it in a file | |
# The, use the certutil command the decode and save in the cert file (pfx) | |
run: | | |
echo ${{ secrets.CERT_PFX }} > certBase64.txt | |
certutil -decode certBase64.txt windows/CERTIFICATE.pfx | |
- name: Packaging to msix | |
if: "!github.event.release.prerelease" | |
# Pipe 'Y' (positive), preceeding command | |
# will ask if comfirmation to install certificate | |
run: echo 'Y' | flutter pub run msix:create | |
- name: Adding markdown | |
if: "!github.event.release.prerelease" | |
run: | | |
echo :white_check_mark: Packaged into .msix file >> $GITHUB_STEP_SUMMARY | |
- name: Upload artifact (.msix) | |
uses: actions/upload-artifact@v3 | |
if: "!github.event.release.prerelease" | |
with: | |
name: windows installer msix | |
path: build/windows/x64/runner/Release/iium_schedule.msix | |
- name: Adding markdown | |
run: | | |
echo :rocket: **Added outputs** to release assets **todo: Publish to winget** >> $GITHUB_STEP_SUMMARY | |
build_macos: | |
name: Build for Mac OS | |
runs-on: macos-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup Flutter | |
uses: subosito/flutter-action@v2 | |
with: | |
channel: "stable" | |
architecture: x64 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 18 | |
- name: Flutter build for MacOS | |
run: | | |
flutter pub get | |
flutter build macos | |
- name: Install appdmg | |
run: | | |
npm install -g appdmg | |
- name: Building the installer | |
run: | | |
appdmg appdmg/config.json appdmg/IIUMSchedule.dmg | |
- name: Upload the installer as an artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: macOS installer DMG | |
path: "appdmg/IIUMSchedule.dmg" | |
upload_assets: | |
name: Upload artifacts to release assets | |
needs: [build_android, build_windows, build_macos] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Download all artifacts | |
uses: actions/download-artifact@v3 | |
- name: Rename apk | |
run: curl -s https://gist.githubusercontent.com/iqfareez/f57405016cc8bcc51cdcd2879c88807a/raw/5d9bbed7231a9e56bf24b88ab5286cee73dae173/rename_apk.sh | bash -s IIUMSchedule . | |
# If the name input parameter is not provided, all artifacts will be downloaded. | |
# To differentiate between downloaded artifacts, a directory denoted by the | |
# artifacts name will be created for each individual artifact. | |
# https://github.com/marketplace/actions/download-a-build-artifact#download-all-artifacts | |
- name: Upload files | |
uses: softprops/action-gh-release@v1 | |
with: | |
files: | | |
apks artifact/*.apk | |
windows installer msix/iium_schedule.msix | |
windows installer exe/iiumschedulesetup.exe | |
macOS installer DMG/*.dmg | |
upload_playstore: | |
name: Upload aab bundle to Play Store | |
if: "!github.event.release.prerelease" | |
needs: [build_android] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Download aab artifact | |
uses: actions/download-artifact@v3 | |
with: | |
name: aab artifact | |
- name: Upload file to the assets release | |
uses: r0adkll/upload-google-play@v1 | |
with: | |
serviceAccountJsonPlainText: ${{ secrets.GOOGLE_PLAY_SERVICE_ACCOUNT }} | |
packageName: com.iqfareez.iiumschedule | |
releaseFiles: app-release.aab | |
track: production | |
# changesNotSentForReview: true | |
status: draft |