Skip to content

v1.0.5 for WEB only #36

v1.0.5 for WEB only

v1.0.5 for WEB only #36

Workflow file for this run

name: Build all on release
on:
release:
types: [published]
jobs:
# Read config file to get the Flutter channel and build targets
read_config:
runs-on: ubuntu-latest
outputs:
flutterVer: ${{ steps.flutter-ver.outputs.data }}
buildWindows: ${{ steps.read-build-windows.outputs.data }}
buildWeb: ${{ steps.read-build-web.outputs.data }}
buildAndroid: ${{ steps.read-build-android.outputs.data }}
buildMacos: ${{ steps.read-build-macos.outputs.data }}
steps:
- name: Checkout repo
uses: actions/checkout@v3
- id: read-flutter-ver
name: Determine Flutter version from ci-config.yml
uses: jbutcher5/[email protected]
with:
file: "./ci-config.yml" # File to read from
key-path: '["flutter_channel"]' # Access the runs key then the using key and retuns the value.
- id: set-flutter-ver
name: Set Flutter version to be built against
run: echo "data=${{ steps.read-flutter-ver.outputs.data }}" >> $GITHUB_OUTPUT
- id: read-build-windows
name: Determine Flutter version from ci-config.yml
uses: jbutcher5/[email protected]
with:
file: "./ci-config.yml"
key-path: '["build_for", "windows"]'
- id: set-build-windows
run: echo "data=${{ steps.read-build-windows.outputs.data }}" >> $GITHUB_OUTPUT
- id: read-build-web
name: Determine Flutter version from ci-config.yml
uses: jbutcher5/[email protected]
with:
file: "./ci-config.yml"
key-path: '["build_for", "web"]'
- id: set-build-web
run: echo "data=${{ steps.read-build-web.outputs.data }}" >> $GITHUB_OUTPUT
- id: read-build-android
name: Determine Flutter version from ci-config.yml
uses: jbutcher5/[email protected]
with:
file: "./ci-config.yml"
key-path: '["build_for", "android"]'
- id: set-build-android
run: echo "data=${{ steps.read-build-android.outputs.data }}" >> $GITHUB_OUTPUT
- id: read-build-macos
name: Determine Flutter version from ci-config.yml
uses: jbutcher5/[email protected]
with:
file: "./ci-config.yml"
key-path: '["build_for", "macos"]'
- id: set-build-macos
run: echo "data=${{ steps.read-build-macos.outputs.data }}" >> $GITHUB_OUTPUT
build_android:
name: Build for Android
needs: read_config
if: ${{ needs.read_config.outputs.buildAndroid == 'true' }}
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v3
- name: Setup Java
uses: actions/[email protected]
with:
distribution: "zulu"
java-version: "11"
- name: Setup Flutter
uses: subosito/[email protected]
with:
channel: "${{ needs.read_config.outputs.flutterVer }}"
# 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_web:
name: Build for web & firebase deploy
needs: read_config
if: ${{ needs.read_config.outputs.buildWeb == 'true' }}
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v3
- name: Setup Flutter
uses: subosito/[email protected]
with:
channel: "${{ needs.read_config.outputs.flutterVer }}"
- name: Build release web
run: |
flutter pub get
flutter build web --web-renderer canvaskit
- name: Adding markdown
run: |
echo 'Build **web** :white_check_mark:' >> $GITHUB_STEP_SUMMARY
- name: Determine Hosting channel
uses: haya14busa/action-cond@v1
id: hostingChannel
with:
cond: ${{github.event.release.prerelease}}
if_true: "staging"
if_false: "live" # prod
- name: Deploy to Firebase Hosting
uses: FirebaseExtended/action-hosting-deploy@v0
id: firebaseDeploy
with:
repoToken: "${{ secrets.GITHUB_TOKEN }}"
firebaseServiceAccount: "${{ secrets.FIREBASE_SERVICE_ACCOUNT_IIUMSCHEDULE_AF71A }}"
channelId: ${{ steps.hostingChannel.outputs.value }}
projectId: iiumschedule-af71a
- name: Adding markdown
run: |
echo ':rocket: Deployed to Firebase **${{ steps.hostingChannel.outputs.value }} channel**. URL **${{ steps.firebaseDeploy.outputs.details_url }}**' >> $GITHUB_STEP_SUMMARY
build_windows:
name: Build for Windows
needs: read_config
if: ${{ needs.read_config.outputs.buildWindows == 'true' }}
runs-on: windows-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Flutter
uses: subosito/[email protected]
with:
channel: "${{ needs.read_config.outputs.flutterVer }}"
- name: Flutter build for Windows
run: |
flutter pub get
flutter build windows
# 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/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
needs: read_config
if: ${{ needs.read_config.outputs.buildMacos == 'true' }}
runs-on: macos-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Flutter
uses: subosito/flutter-action@v2
with:
channel: ${{ inputs.flutterChannel }}
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:
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: Download all artifacts
uses: actions/download-artifact@v3
# 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
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