Merge pull request #61 from wednesday-solutions/main #41
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: CD | |
on: | |
push: | |
branches: | |
- release | |
workflow_dispatch: | |
jobs: | |
build-android: | |
name: Release Android To AppCenter | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
steps: | |
- uses: actions/checkout@v3 | |
# Replace with your Personal Access Tokens | |
with: | |
token: ${{ secrets.SHOUNAK_GITHUB_TOKEN }} | |
- uses: actions/setup-java@v4 | |
with: | |
distribution: 'corretto' | |
java-version: '17' | |
- uses: subosito/flutter-action@v2 | |
with: | |
channel: 'stable' | |
cache: true | |
cache-key: "flutterCacheV1-:os:-:channel:-:version:-:arch:-:hash:" | |
pub-cache-key: "flutterPubCacheV1-:os:-:channel:-:version:-:arch:-:hash:" | |
- name: Setup .env.qa | |
env: | |
ENV_FILE: ${{ secrets.ENV_QA }} | |
run: echo -n $ENV_FILE | base64 --decode > .env.qa | |
- name: Setup .env.prod | |
env: | |
ENV_FILE: ${{ secrets.ENV_PROD }} | |
run: echo -n $ENV_FILE | base64 --decode > .env.prod | |
- name: Activate derry | |
run: flutter pub global activate derry | |
- name: Get Dependencies | |
run: flutter pub get | |
- name: Run build_runner | |
run: derry build_runner | |
- name: Bump Version | |
run: scripts/bump-build-number.sh | |
- name: Decode Keystore | |
id: decode_keystore | |
uses: timheuer/base64-to-file@v1 | |
with: | |
fileName: 'flutter_template_keystore.jks' | |
encodedString: ${{ secrets.KEYSTORE }} | |
- name: Set Flavor Name | |
run: scripts/set-flavor-and-apk-path-to-env.sh | |
- name: Build APK | |
run: derry build release-apk $FLAVOR_NAME | |
env: | |
KEY_STORE_PATH: ${{ steps.decode_keystore.outputs.filePath }} | |
RELEASE_STORE_PASSWORD: ${{ secrets.RELEASE_STORE_PASSWORD }} | |
RELEASE_KEY_ALIAS: ${{ secrets.RELEASE_KEY_ALIAS }} | |
RELEASE_KEY_PASSWORD: ${{ secrets.RELEASE_KEY_PASSWORD }} | |
- name: Upload Artifact to App Center | |
uses: wzieba/AppCenter-Github-Action@v1 | |
with: | |
appName: wednesday-solutions/ANDROID-Flutter-Template | |
token: ${{ secrets.APP_CENTER_TOKEN }} | |
group: Testers | |
file: ${{ env.APK_PATH }} | |
notifyTesters: true | |
- name: Add Tag Name to ENV | |
run: scripts/gh-action-read-and-set-version-env.sh | |
- name: Create Release and Add APK Artifact | |
uses: softprops/action-gh-release@v1 | |
with: | |
tag_name: ${{ env.tag_name }} | |
files: | | |
${{ env.APK_PATH }} | |
debug-info/app.android-arm.symbols | |
debug-info/app.android-arm64.symbols | |
debug-info/app.android-x64.symbols | |
build-ios: | |
name: Release iOS to TestFlight | |
runs-on: macos-latest | |
steps: | |
- name: iOS build disabled | |
run: echo Uncomment "build-ios" job to build and deploy ios app. | |
# - uses: actions/checkout@v3 | |
# with: | |
# token: ${{ secrets.SHOUNAK_GITHUB_TOKEN }} | |
# | |
# - uses: subosito/flutter-action@v2 | |
# with: | |
# channel: 'stable' | |
# cache: true | |
# | |
# - name: Setup .env.qa | |
# env: | |
# ENV_FILE: ${{ secrets.ENV_QA }} | |
# run: echo -n $ENV_FILE | base64 --decode > .env.qa | |
# | |
# - name: Setup .env.prod | |
# env: | |
# ENV_FILE: ${{ secrets.ENV_PROD }} | |
# run: echo -n $ENV_FILE | base64 --decode > .env.prod | |
# | |
# - name: Activate derry | |
# run: flutter pub global activate derry | |
# | |
# - name: Get Dependencies | |
# run: flutter pub get | |
# | |
# - name: Run build_runner | |
# run: derry build_runner | |
# | |
# - uses: maxim-lobanov/setup-xcode@v1 | |
# with: | |
# xcode-version: latest-stable | |
# | |
# - name: Install the Apple certificate and provisioning profile | |
# env: | |
# BUILD_CERTIFICATE_BASE64: ${{ secrets.BUILD_CERTIFICATE_BASE64 }} | |
# P12_PASSWORD: ${{ secrets.P12_PASSWORD }} | |
# BUILD_PROVISION_PROFILE_BASE64: ${{ secrets.BUILD_PROVISION_PROFILE_BASE64 }} | |
# KEYCHAIN_PASSWORD: ${{ secrets.KEYCHAIN_PASSWORD }} | |
# run: chmod u+x scripts/install_certs.sh && scripts/install_certs.sh | |
# | |
# - name: Retrieve Export-Options.plist from secrets | |
# env: | |
# PLIST: ${{ secrets.IOS_PLIST }} | |
# PLIST_PATH: ${{ runner.temp }}/options.plist | |
# run: echo -n "$PLIST" | base64 --decode --output $PLIST_PATH | |
# | |
# - name: Build the signed ipa | |
# # TODO: Move to derry | |
# run: chmod u+x scripts/build.sh && scripts/build.sh ipa prod --release | |
# | |
# - name: Upload the signed ipa to TestFlight | |
# env: | |
# PASSWORD: ${{ secrets.APPSTORE_PASSWORD }} | |
# IPA_PATH: build/ios/ipa/prod.ipa | |
# run: xcrun altool --upload-app --file $IPA_PATH --username "ios@wednesday.is" --password $PASSWORD --type ios --verbose | |
commit-version-update: | |
name: Commit Version Change | |
runs-on: ubuntu-latest | |
needs: [ build-android, build-ios ] | |
steps: | |
- uses: actions/checkout@v3 | |
# Replace with your Personal Access Token | |
with: | |
token: ${{ secrets.SHOUNAK_GITHUB_TOKEN }} | |
- name: Bump Version | |
run: scripts/bump-build-number.sh | |
- name: Configure Git | |
run: | | |
git config user.name "Github Actions CD" | |
git config user.email "<>" | |
- name: Commit Version Change | |
run: scripts/commit-version.sh | |