This repository has been archived by the owner on Jan 19, 2024. It is now read-only.
HOTFIX: Background task no longer loads all grades #12
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: Flutter CI | |
on: | |
push: | |
branches: [stable] | |
jobs: | |
version: | |
name: Create version number | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v1 | |
- name: Fetch all history for all tags and branches | |
run: | | |
git config remote.origin.url https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }} | |
git fetch --prune --depth=10000 | |
- name: Install GitVersion | |
uses: gittools/actions/gitversion/[email protected] | |
with: | |
versionSpec: "5.x" | |
- name: Use GitVersion | |
id: gitversion | |
uses: gittools/actions/gitversion/[email protected] | |
- name: Create version.txt with nuGetVersion | |
run: echo ${{ steps.gitversion.outputs.nuGetVersion }} > version.txt | |
- name: Upload version.txt | |
uses: actions/upload-artifact@v2 | |
with: | |
name: gitversion | |
path: version.txt | |
buildandroid: | |
name: Build APK & appbundle for Android | |
needs: [version] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v1 | |
- name: Get version.txt | |
uses: actions/download-artifact@v2 | |
with: | |
name: gitversion | |
- name: Create new file without newline char from version.txt | |
run: tr -d '\n' < version.txt > version1.txt | |
- name: Read version | |
id: version | |
uses: juliangruber/read-file-action@v1 | |
with: | |
path: version1.txt | |
- name: Load keystore | |
run: echo "${{ secrets.BASE64_KEY_STORE }}" | base64 -d > ./android/app/release-key.jks | |
- name: Load key.properties | |
run: echo "${{ secrets.KEY_PROPERTIES }}" | base64 -d > ./android/key.properties | |
- name: Update version in YAML | |
run: sed -i 's/0.0.1+99/${{ steps.version.outputs.content }}+${{ github.run_number }}/g' pubspec.yaml | |
- uses: actions/setup-java@v1 | |
with: | |
java-version: "12.x" | |
- uses: subosito/flutter-action@v1 | |
with: | |
channel: "stable" | |
- run: flutter clean | |
- run: flutter pub get | |
- run: flutter build apk --release --split-per-abi | |
- run: flutter build appbundle --release | |
- name: Upload appbundle | |
uses: actions/upload-artifact@v3 | |
with: | |
name: android-aab-releases | |
path: build/app/outputs/bundle/release/app-release.aab | |
- name: Upload apks | |
uses: actions/upload-artifact@v3 | |
with: | |
name: android-apk-releases | |
path: build/app/outputs/apk/release/*.apk | |
buildios: | |
name: Build ipa for iOS | |
needs: [version] | |
runs-on: macos-latest | |
steps: | |
- uses: actions/checkout@v1 | |
- name: Get version.txt | |
uses: actions/download-artifact@v2 | |
with: | |
name: gitversion | |
- name: Create new file without newline char from version.txt | |
run: tr -d '\n' < version.txt > version1.txt | |
- name: Read version | |
id: version | |
uses: juliangruber/read-file-action@v1 | |
with: | |
path: version1.txt | |
- name: Update version in YAML | |
run: sed -i'.ori' -e 's/0.0.1+99/${{ steps.version.outputs.content }}+${{ github.run_number }}/g' pubspec.yaml | |
- name: Install the Apple certificate and provisioning profile | |
env: | |
BUILD_CERTIFICATE_BASE64: ${{ secrets.APPSTORE_CERT_BASE64 }} | |
P12_PASSWORD: ${{ secrets.APPSTORE_CERT_PASSWORD }} | |
BUILD_PROVISION_PROFILE_BASE64: ${{ secrets.MOBILEPROVISION_BASE64 }} | |
KEYCHAIN_PASSWORD: ${{ secrets.KEYCHAIN_PASSWORD }} | |
run: | | |
# create variables | |
CERTIFICATE_PATH=$RUNNER_TEMP/build_certificate.p12 | |
PP_PATH=$RUNNER_TEMP/build_pp.mobileprovision | |
KEYCHAIN_PATH=$RUNNER_TEMP/app-signing.keychain-db | |
# import certificate and provisioning profile from secrets | |
echo -n "$BUILD_CERTIFICATE_BASE64" | base64 --decode --output $CERTIFICATE_PATH | |
echo -n "$BUILD_PROVISION_PROFILE_BASE64" | base64 --decode --output $PP_PATH | |
# create temporary keychain | |
security create-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH | |
security set-keychain-settings -lut 21600 $KEYCHAIN_PATH | |
security unlock-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH | |
# import certificate to keychain | |
security import $CERTIFICATE_PATH -P "$P12_PASSWORD" -A -t cert -f pkcs12 -k $KEYCHAIN_PATH | |
security list-keychain -d user -s $KEYCHAIN_PATH | |
# apply provisioning profile | |
mkdir -p ~/Library/MobileDevice/Provisioning\ Profiles | |
cp $PP_PATH ~/Library/MobileDevice/Provisioning\ Profiles | |
- uses: actions/setup-java@v1 | |
with: | |
java-version: "12.x" | |
- uses: subosito/flutter-action@v1 | |
with: | |
channel: "stable" | |
- run: flutter clean | |
- run: flutter pub get | |
- run: flutter build ipa --release --export-options-plist=ios/Runner/ExportOptions.plist | |
- name: Clean up keychain and provisioning profile | |
if: ${{ always() }} | |
run: | | |
security delete-keychain $RUNNER_TEMP/app-signing.keychain-db | |
rm ~/Library/MobileDevice/Provisioning\ Profiles/build_pp.mobileprovision | |
- name: Upload ipa | |
uses: actions/upload-artifact@v3 | |
with: | |
name: ios-release | |
path: build/ios/ipa/*.ipa | |
release: | |
name: Create a Github release | |
needs: [buildandroid, buildios] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v1 | |
- name: Get version.txt | |
uses: actions/download-artifact@v2 | |
with: | |
name: gitversion | |
- name: Create new file without newline char from version.txt | |
run: tr -d '\n' < version.txt > version1.txt | |
- name: Read version | |
id: version | |
uses: juliangruber/read-file-action@v1 | |
with: | |
path: version1.txt | |
- name: Download Android appbundle | |
uses: actions/download-artifact@v3 | |
with: | |
name: android-aab-releases | |
- name: Download Android apks | |
uses: actions/download-artifact@v3 | |
with: | |
name: android-apk-releases | |
- name: Download iOS release | |
uses: actions/download-artifact@v3 | |
with: | |
name: ios-release | |
- name: Create a Release in GitHub | |
uses: ncipollo/release-action@v1 | |
with: | |
artifacts: "*.apk,app-release.aab,*.ipa" | |
generateReleaseNotes: true | |
token: ${{ secrets.GH_TOKEN }} | |
tag: ${{ steps.version.outputs.content }} | |
commit: ${{ github.sha }} | |
# release: | |
# name: Release app to internal track | |
# needs: [build] | |
# runs-on: ubuntu-latest | |
# steps: | |
# - uses: actions/checkout@v1 | |
# - name: Get appbundle from artifacts | |
# uses: actions/download-artifact@v2 | |
# with: | |
# name: appbundle | |
# - name: Release app to internal track | |
# uses: r0adkll/upload-google-play@v1 | |
# with: | |
# serviceAccountJsonPlainText: ${{ secrets.PLAYSTORE_ACCOUNT_KEY }} | |
# packageName: dev.harrydekat.silvio | |
# releaseFiles: app-release.aab | |
# track: internal | |
# status: completed |