Update dependencies and configuration files #274
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: | |
push: | |
branches: | |
- deploy | |
env: | |
flutter_channel: stable | |
java_version: 8.x | |
TZ: Europe/Zurich | |
jobs: | |
create-release: | |
runs-on: ubuntu-latest | |
timeout-minutes: 10 | |
name: create release & upload artifacts | |
needs: | |
- build-android-prod | |
- build-windows-prod | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- name: Get git infos | |
id: git-data | |
run: bash $GITHUB_WORKSPACE/CI/github_git_data.sh | |
- name: Download apk artifact | |
uses: actions/download-artifact@v2 | |
with: | |
name: app-release.apk | |
path: artifacts/app-release | |
- name: Download windows artifact | |
uses: actions/download-artifact@v2 | |
with: | |
name: windows-release | |
path: artifacts/windows-release | |
- name: Set windows archive name | |
run: echo "ARCHIVE_NAME='swift-travel-windows-release-${{ env.COMMIT_NUMBER }}'" >> $GITHUB_ENV | |
- name: Zip windows artifact | |
run: | | |
echo "windows release name is ${{ env.ARCHIVE_NAME }}" | |
mv windows-release ${{ env.ARCHIVE_NAME }} | |
zip -r windows-release.zip ${{ env.ARCHIVE_NAME }}/ | |
working-directory: artifacts/ | |
- name: List dir | |
run: ls -la | sort | |
working-directory: artifacts/ | |
- name: Create Release | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token | |
with: | |
tag_name: ci-deploy-${{ env.APP_VERSION }}+${{ env.COMMIT_NUMBER }} | |
release_name: | | |
${{ env.APP_VERSION }}+${{ env.COMMIT_NUMBER }} | |
body: | | |
*This is an automated CI build for ${{ env.GIT_SHORT_SHA }}.* | |
`${{ env.COMMIT_MSG }}` | |
draft: false | |
- name: Upload APK | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps | |
asset_path: artifacts/app-release/app-release.apk | |
asset_name: swift-travel-${{ env.COMMIT_NUMBER }}.apk | |
asset_content_type: application/vnd.android.package-archive | |
- name: Upload Windows archive | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps | |
asset_path: artifacts/windows-release.zip | |
asset_name: ${{ env.ARCHIVE_NAME }}.zip | |
asset_content_type: application/zip | |
build-windows-prod: | |
runs-on: windows-latest | |
timeout-minutes: 10 | |
name: build windows | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- name: Pull cache | |
uses: actions/cache@v2 | |
with: | |
path: | | |
$HOME/.pub-cache | |
key: ${{ runner.OS }}-flutter-cache-${{ env.flutter_channel }} | |
- name: Install Flutter | |
uses: subosito/flutter-action@v1 | |
with: | |
channel: ${{ env.flutter_channel }} | |
- name: Get git infos | |
id: git-data | |
run: bash CI/github_git_data.sh | |
- name: Get dependencies | |
working-directory: app/ | |
run: flutter packages get | |
- name: Pre-build configuration | |
working-directory: app/ | |
run: bash $GITHUB_WORKSPACE/CI/prebuild.sh | |
shell: bash | |
- name: Build | |
working-directory: app/ | |
run: | | |
flutter config --enable-windows-desktop | |
flutter build windows | |
- name: Upload windows executable | |
uses: actions/upload-artifact@v2 | |
with: | |
name: windows-release | |
path: app/build/windows/runner/Release/ | |
build-android-prod: | |
runs-on: ubuntu-latest | |
timeout-minutes: 10 | |
name: build android | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- name: Pull cache | |
uses: actions/cache@v2 | |
with: | |
path: | | |
$HOME/.pub-cache | |
key: ${{ runner.OS }}-flutter-cache-${{ env.flutter_channel }} | |
- name: Install Flutter | |
uses: subosito/flutter-action@v1 | |
with: | |
channel: ${{ env.flutter_channel }} | |
- name: Get git infos | |
id: git-data | |
run: bash $GITHUB_WORKSPACE/CI/github_git_data.sh | |
- name: Get dependencies | |
working-directory: app/ | |
run: flutter packages get | |
- name: Pre-build configuration | |
working-directory: app/ | |
run: bash $GITHUB_WORKSPACE/CI/prebuild.sh | |
env: | |
KEY_PROPERTIES: ${{ secrets.KEY_PROPERTIES }} | |
- name: Build | |
working-directory: app/ | |
run: flutter build apk --build-number ${{ env.COMMIT_NUMBER }} | |
- name: Upload apk | |
uses: actions/upload-artifact@v2 | |
with: | |
name: app-release.apk | |
path: app/build/app/outputs/flutter-apk/app-release.apk | |
deploy-web-prod: | |
runs-on: ubuntu-latest | |
timeout-minutes: 10 | |
name: build web | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- name: Pull cache | |
uses: actions/cache@v2 | |
with: | |
path: | | |
$HOME/.pub-cache | |
key: ${{ runner.OS }}-flutter-cache-${{ env.flutter_channel }} | |
- name: Install Flutter | |
uses: subosito/flutter-action@v1 | |
with: | |
channel: ${{ env.flutter_channel }} | |
- name: Get git infos | |
id: git-data | |
run: bash $GITHUB_WORKSPACE/CI/github_git_data.sh | |
- name: Get dependencies | |
working-directory: app/ | |
run: | | |
flutter config --enable-web | |
flutter packages get | |
- name: Pre-build configuration | |
working-directory: app/ | |
run: bash $GITHUB_WORKSPACE/CI/prebuild.sh | |
- name: Build | |
working-directory: app/ | |
run: flutter build web | |
# - uses: FirebaseExtended/action-hosting-deploy@v0 | |
# with: | |
# repoToken: "${{ secrets.GITHUB_TOKEN }}" | |
# firebaseServiceAccount: "${{ secrets.FIREBASE_SERVICE_ACCOUNT_SWISS_TRAVEL_36188 }}" | |
# projectId: swiss-travel-36188 | |
# channelId: live | |
# env: | |
# FIREBASE_CLI_PREVIEWS: hostingchannels |