Krille/test deploy to testflight #46
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: Release Workflow | |
on: | |
pull_request: | |
#release: | |
# types: | |
# - created | |
concurrency: | |
group: release_workflow | |
cancel-in-progress: true | |
jobs: | |
build_web: | |
if: false | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- run: cat .github/workflows/versions.env >> $GITHUB_ENV | |
- uses: subosito/flutter-action@v2 | |
with: | |
flutter-version: ${{ env.FLUTTER_VERSION }} | |
cache: true | |
- name: Install dependencies | |
run: sudo apt-get update && sudo apt-get install nodejs -y | |
- run: flutter pub get | |
- name: Prepare web | |
run: ./scripts/prepare-web.sh | |
- name: Build Release Web | |
run: flutter build web --release --source-maps | |
- name: Create archive | |
run: tar -czf fluffychat-web.tar.gz build/web/ | |
- name: Upload Web Build | |
uses: actions/upload-artifact@v2 | |
with: | |
name: Web Build | |
path: fluffychat-web.tar.gz | |
- name: Upload to release | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.PAGES_DEPLOY_TOKEN }} | |
with: | |
upload_url: ${{ github.event.release.upload_url }} | |
asset_path: fluffychat-web.tar.gz | |
asset_name: fluffychat-web.tar.gz | |
asset_content_type: application/gzip | |
build_apk: | |
runs-on: ubuntu-latest | |
if: false | |
steps: | |
- uses: actions/checkout@v2 | |
- run: cat .github/workflows/versions.env >> $GITHUB_ENV | |
- uses: actions/setup-java@v1 | |
with: | |
java-version: ${{ env.JAVA_VERSION }} | |
- uses: subosito/flutter-action@v2 | |
with: | |
flutter-version: ${{ env.FLUTTER_VERSION }} | |
cache: true | |
- name: Apply Google Services Patch | |
run: git apply ./scripts/enable-android-google-services.patch | |
- run: flutter pub get | |
- name: Prepare Android Release Build | |
env: | |
FDROID_KEY: ${{ secrets.FDROID_KEY }} | |
FDROID_KEY_PASS: ${{ secrets.FDROID_KEY_PASS }} | |
PLAYSTORE_DEPLOY_KEY: ${{ secrets.PLAYSTORE_DEPLOY_KEY }} | |
run: ./scripts/prepare-android-release.sh | |
- run: flutter build apk --release | |
- name: Upload to release | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.PAGES_DEPLOY_TOKEN }} | |
with: | |
upload_url: ${{ github.event.release.upload_url }} | |
asset_path: build/app/outputs/apk/release/app-release.apk | |
asset_name: fluffychat.apk | |
asset_content_type: application/vnd.android.package-archive | |
build_linux: | |
runs-on: ubuntu-latest | |
if: false | |
steps: | |
- uses: actions/checkout@v2 | |
- run: cat .github/workflows/versions.env >> $GITHUB_ENV | |
- uses: subosito/flutter-action@v2 | |
with: | |
flutter-version: ${{ env.FLUTTER_VERSION }} | |
cache: true | |
- name: Install dependencies | |
run: sudo apt-get update && sudo apt-get install curl clang cmake ninja-build pkg-config libgtk-3-dev libblkid-dev liblzma-dev libjsoncpp-dev cmake-data libsecret-1-dev libsecret-1-0 librhash0 -y | |
- run: flutter pub get | |
- run: flutter build linux --release --target-platform linux-x64 | |
- name: Create archive | |
run: tar -czf fluffychat-linux-x64.tar.gz build/linux/x64/release/bundle/ | |
- name: Upload to release | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.PAGES_DEPLOY_TOKEN }} | |
with: | |
upload_url: ${{ github.event.release.upload_url }} | |
asset_path: fluffychat-linux-x64.tar.gz | |
asset_name: fluffychat-linux-x64.tar.gz | |
asset_content_type: application/gzip | |
deploy_playstore: | |
runs-on: ubuntu-latest | |
if: false | |
steps: | |
- uses: actions/checkout@v2 | |
- run: cat .github/workflows/versions.env >> $GITHUB_ENV | |
- uses: actions/setup-java@v1 | |
with: | |
java-version: ${{ env.JAVA_VERSION }} | |
- uses: subosito/flutter-action@v2 | |
with: | |
flutter-version: ${{ env.FLUTTER_VERSION }} | |
cache: true | |
- name: Set up Ruby | |
uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: 2.7 | |
- name: Install Fastlane | |
run: gem install fastlane -NV | |
- name: Apply Google Services Patch | |
run: git apply ./scripts/enable-android-google-services.patch | |
- run: flutter pub get | |
- name: Prepare Android Release Build | |
env: | |
FDROID_KEY: ${{ secrets.FDROID_KEY }} | |
FDROID_KEY_PASS: ${{ secrets.FDROID_KEY_PASS }} | |
PLAYSTORE_DEPLOY_KEY: ${{ secrets.PLAYSTORE_DEPLOY_KEY }} | |
run: ./scripts/prepare-android-release.sh | |
- name: Build Android Release | |
run: flutter build appbundle --target-platform android-arm,android-arm64,android-x64 | |
- name: Get Tag Name | |
id: tag_name | |
run: echo "::set-output name=tag::$(echo ${GITHUB_REF#refs/tags/})" | |
- name: Copy aab file to build dir | |
run: | | |
mkdir -p build/android | |
cp build/app/outputs/bundle/release/app-release.aab build/android/ | |
- name: Update fastlane | |
run: bundle install && bundle update fastlane | |
working-directory: android | |
- name: Deploy to Internal test | |
working-directory: android | |
run: bundle exec fastlane deploy_internal_test | |
- name: Deploy Android Release | |
working-directory: android | |
run: | | |
if [[ $GITHUB_REF_NAME == rc* ]]; then | |
bundle exec fastlane deploy_candidate | |
else | |
bundle exec fastlane deploy_release | |
fi | |
deploy_testflight: | |
runs-on: macos-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- run: cat .github/workflows/versions.env >> $GITHUB_ENV | |
- uses: subosito/flutter-action@v2 | |
with: | |
flutter-version: ${{ env.FLUTTER_VERSION }} | |
cache: true | |
- name: Set up Ruby | |
uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: 2.7 | |
- run: gem install fastlane -NV | |
- name: Apply Google Services Patch | |
run: git apply ./scripts/enable-android-google-services.patch | |
- run: flutter pub get | |
- name: Update fastlane | |
run: bundle install | |
working-directory: ios | |
- name: Install Cocoapod Dependencies | |
working-directory: ios | |
run: pod install | |
- name: Provide api key file | |
working-directory: ios/fastlane | |
env: | |
APPSTORE_API_KEY: ${{ secrets.APPSTORE_API_KEY }} | |
run: echo $APPSTORE_API_KEY >> api_key.json | |
- name: Install the Apple certificate and provisioning profile | |
# To update this job or the secrets in it, take a look at: | |
# https://docs.github.com/en/actions/deployment/deploying-xcode-applications/installing-an-apple-certificate-on-macos-runners-for-xcode-development | |
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 }} | |
FASTLANE_PASSWORD: ${{ secrets.FASTLANE_APPLE_APPLICATION_SPECIFIC_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 -o $CERTIFICATE_PATH | |
echo -n "$BUILD_PROVISION_PROFILE_BASE64" | base64 --decode -o $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 | |
- name: Push a new beta build to TestFlight | |
working-directory: ios | |
env: | |
FASTLANE_DONT_STORE_PASSWORD: 1 | |
run: bundle exec fastlane beta | |
- name: Clean up keychain and provisioning profile | |
run: | | |
security delete-keychain $RUNNER_TEMP/app-signing.keychain-db | |
rm ~/Library/MobileDevice/Provisioning\ Profiles/build_pp.mobileprovision | |
promote_snapcraft: | |
runs-on: ubuntu-latest | |
if: false | |
env: | |
SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.SNAPCRAFT_TOKEN }} | |
steps: | |
- name: Check out Git repository | |
uses: actions/checkout@v3 | |
- name: Install Snapcraft | |
uses: samuelmeuli/action-snapcraft@v2 | |
- name: Install expect | |
run: sudo apt-get update && sudo apt-get install -y expect | |
- name: Promote Snap | |
run: | | |
RELEASE_TYPE=$(echo "${{ github.ref }}" | awk -F"/" '{print $3}') | |
if [ "$RELEASE_TYPE" = "rc" ]; then | |
expect -c " | |
spawn snapcraft promote fluffychat --from-channel edge --to-channel candidate | |
expect \"Do you want to promote the current set to the 'candidate' channel? [y/N]:\" | |
send \"y\r\" | |
expect eof | |
" | |
else | |
snapcraft promote fluffychat --from-channel candidate --to-channel stable --yes | |
fi |