Deploy #8
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: Deploy | |
on: | |
workflow_dispatch: | |
jobs: | |
job-linux: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: subosito/[email protected] | |
with: | |
channel: 'stable' | |
architecture: x64 | |
- uses: actions/checkout@v2 | |
with: | |
lfs: 'true' | |
- name: Update dependencies | |
run: | | |
flutter config --enable-linux-desktop | |
flutter doctor | |
sudo apt-get update -y | |
sudo apt-get install -y clang cmake ninja-build pkg-config libgtk-3-dev libblkid-dev tree | |
flutter doctor | |
flutter pub get | |
- name: Generate app build name | |
shell: bash | |
run: echo "##[set-output name=name;]$(echo sweet_$GITHUB_RUN_NUMBER)" | |
id: app_build | |
- name: Building ${{ steps.app_build.outputs.name }} Linux | |
run: flutter build linux --release --verbose | |
- name: 'Zipping build' | |
run: | | |
pushd build/linux/x64/release/bundle/ | |
zip -r ${{ steps.app_build.outputs.name }}-linux.zip ./* | |
popd | |
mv build/linux/x64/release/bundle/${{ steps.app_build.outputs.name }}-linux.zip ./${{ steps.app_build.outputs.name }}-linux.zip | |
- name: 'Uploading artifact' | |
uses: actions/[email protected] | |
with: | |
name: ${{ steps.app_build.outputs.name }}-linux | |
path: ${{ steps.app_build.outputs.name }}-linux.zip | |
retention-days: 5 | |
# WINDOWS | |
job-windows: | |
runs-on: windows-latest | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
lfs: 'true' | |
- uses: subosito/[email protected] | |
with: | |
channel: 'stable' | |
architecture: x64 | |
- name: Update dependencies | |
run: | | |
flutter config --enable-windows-desktop | |
flutter pub get | |
- name: Generate app build name | |
shell: bash | |
run: echo "##[set-output name=name;]$(echo sweet_$GITHUB_RUN_NUMBER)" | |
id: app_build | |
- name: Update Windows build number | |
shell: bash | |
run: | | |
VERSION_FROM_PUBSPEC=$(sed -n -e '/version: / s///p' pubspec.yaml | tr -d '\r\n') | |
VERSION=$(echo -n $VERSION_FROM_PUBSPEC | sed -E -e "s/((([0-9])+\.([0-9])+\.([0-9])+)\+(([0-9])+))/\2+$GITHUB_RUN_NUMBER/") | |
echo "Setting windows version to $VERSION" | |
sed -i -E -e "s/((([0-9])+\.([0-9])+\.([0-9])+(([\+])([0-9])+)?))/$VERSION/" windows/runner/Runner.rc | |
- name: Building ${{ steps.app_build.outputs.name }} Windows | |
run: flutter build windows --release | |
- name: 'Zipping build' | |
uses: vimtor/action-zip@v1 | |
with: | |
dest: ${{ steps.app_build.outputs.name }}-windows.zip | |
files: build/windows/runner/Release | |
- name: 'Uploading artifact' | |
uses: actions/[email protected] | |
with: | |
name: ${{ steps.app_build.outputs.name }}-windows | |
path: ${{ steps.app_build.outputs.name }}-windows.zip | |
retention-days: 5 | |
job-apple: | |
runs-on: macos-latest | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
lfs: 'true' | |
- uses: subosito/[email protected] | |
with: | |
channel: 'stable' | |
architecture: x64 | |
- name: Update dependencies | |
run: | | |
flutter config --enable-macos-desktop | |
flutter pub get | |
- name: Generate app build name | |
shell: bash | |
run: echo "##[set-output name=name;]$(echo sweet_$GITHUB_RUN_NUMBER)" | |
id: app_build | |
- name: Building ${{ steps.app_build.outputs.name }} iOS | |
run: flutter build ios --build-number $GITHUB_RUN_NUMBER --release --no-codesign --config-only | |
- name: Setup Ruby | |
uses: ruby/[email protected] | |
with: | |
bundler-cache: true | |
- name: Build and upload to TestFlight | |
run: | | |
bundle install | |
bundle exec fastlane ios beta | |
env: | |
SWEET_MATCH_ACCESS_TOKEN: ${{ secrets.SWEET_MATCH_ACCESS_TOKEN }} | |
MATCH_PASSWORD: ${{ secrets.MATCH_PASSWORD }} | |
FASTLANE_USER: ${{ secrets.FASTLANE_APPLE_ID }} | |
FASTLANE_APPLE_APPLICATION_SPECIFIC_PASSWORD: ${{ secrets.FASTLANE_APPLE_APPLICATION_SPECIFIC_PASSWORD }} | |
FASTLANE_APPLE_ID: ${{ secrets.FASTLANE_APPLE_ID }} | |
FASTLANE_ITC_TEAM_ID: ${{ secrets.FASTLANE_ITC_TEAM_ID }} | |
FASTLANE_TEAM_ID: ${{ secrets.FASTLANE_TEAM_ID }} | |
- name: Building ${{ steps.app_build.outputs.name }} MacOS | |
run: flutter build macos --build-number $GITHUB_RUN_NUMBER --release | |
- name: 'Zipping build' | |
run: | | |
pushd build/macos/Build/Products/Release/ | |
zip -r ${{ steps.app_build.outputs.name }}-macos.zip SWEET.app | |
popd | |
mv build/macos/Build/Products/Release/${{ steps.app_build.outputs.name }}-macos.zip ./${{ steps.app_build.outputs.name }}-macos.zip | |
- name: 'Uploading artifact' | |
uses: actions/[email protected] | |
with: | |
name: ${{ steps.app_build.outputs.name }}-macos | |
path: ${{ steps.app_build.outputs.name }}-macos.zip | |
retention-days: 5 | |
job-android: | |
runs-on: ubuntu-latest | |
env: | |
KEYSTORE_PASSWORD: ${{ secrets.KEYSTORE_PASSWORD }} | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
lfs: 'true' | |
- name: Decode Upload keystore | |
working-directory: ./android | |
run: | | |
echo "${{ secrets.UPLOAD_KEYSTORE }}" > key.jks.asc | |
gpg -d --passphrase ${{ secrets.UPLOAD_KEYSTORE_PASSPHRASE }} --batch key.jks.asc > key.jks | |
- uses: actions/setup-java@v1 | |
with: | |
java-version: '12.x' | |
- uses: subosito/[email protected] | |
with: | |
channel: 'stable' | |
architecture: x64 | |
- name: Update dependencies | |
run: flutter pub get | |
- name: Generate app build name | |
shell: bash | |
run: echo "##[set-output name=name;]$(echo sweet_$GITHUB_RUN_NUMBER)" | |
id: app_build | |
- name: Building ${{ steps.app_build.outputs.name }}.aab | |
run: flutter build appbundle --build-number $GITHUB_RUN_NUMBER --release | |
- name: Setup Ruby | |
uses: ruby/[email protected] | |
with: | |
bundler-cache: true | |
- name: Upload to Play Store | |
run: | | |
bundle install --jobs 4 --retry 3 | |
bundle exec fastlane android upload_playstore | |
env: | |
SWEET_JSON_KEY_DATA: ${{ secrets.SWEET_JSON_KEY_DATA }} | |
AAB_PATH: build/app/outputs/bundle/release/app-release.aab | |
upload-release-s3: | |
needs: [job-linux, job-apple, job-windows] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Generate app build name | |
shell: bash | |
run: echo "##[set-output name=name;]$(echo sweet_$GITHUB_RUN_NUMBER)" | |
id: app_build | |
- name: 'Download Linux artifact' | |
uses: actions/[email protected] | |
with: | |
name: ${{ steps.app_build.outputs.name }}-linux | |
- name: 'Download MacOS artifact' | |
uses: actions/[email protected] | |
with: | |
name: ${{ steps.app_build.outputs.name }}-macos | |
- name: 'Download Windows artifact' | |
uses: actions/[email protected] | |
with: | |
name: ${{ steps.app_build.outputs.name }}-windows | |
# Disabled for now for testing | |
# - name: Upload Windows releases to S3 | |
# uses: qoqa/[email protected] | |
# env: | |
# AWS_S3_BUCKET: ${{ secrets.AWS_BUCKET }} | |
# AWS_ACCESS_KEY_ID: ${{ secrets.AWS_KEY_ID }} | |
# AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
# FILE: './${{ steps.app_build.outputs.name }}-windows.zip' | |
# AWS_S3_PATH: '/releases/${{ steps.app_build.outputs.name }}-windows.zip' | |
# - name: Upload MacOS releases to S3 | |
# uses: qoqa/[email protected] | |
# env: | |
# AWS_S3_BUCKET: ${{ secrets.AWS_BUCKET }} | |
# AWS_ACCESS_KEY_ID: ${{ secrets.AWS_KEY_ID }} | |
# AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
# FILE: './${{ steps.app_build.outputs.name }}-macos.zip' | |
# AWS_S3_PATH: '/releases/${{ steps.app_build.outputs.name }}-macos.zip' | |
# - name: Upload Linux releases to S3 | |
# uses: qoqa/[email protected] | |
# env: | |
# AWS_S3_BUCKET: ${{ secrets.AWS_BUCKET }} | |
# AWS_ACCESS_KEY_ID: ${{ secrets.AWS_KEY_ID }} | |
# AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
# FILE: './${{ steps.app_build.outputs.name }}-linux.zip' | |
# AWS_S3_PATH: '/releases/${{ steps.app_build.outputs.name }}-linux.zip' | |