You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
207 lines
7.4 KiB
YAML
207 lines
7.4 KiB
YAML
name: Release Workflow
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- production
|
|
|
|
concurrency:
|
|
group: release_workflow
|
|
cancel-in-progress: true
|
|
|
|
env:
|
|
REGISTRY: ghcr.io
|
|
IMAGE_NAME: ${{ github.repository }}
|
|
WEB_APP_ENV: ${{ vars.WEB_APP_ENV }}
|
|
|
|
jobs:
|
|
create_release:
|
|
name: "Tagged Release"
|
|
runs-on: "ubuntu-latest"
|
|
outputs:
|
|
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
|
steps:
|
|
- name: Checkout Repository
|
|
uses: actions/checkout@v4
|
|
- name: Get Version from pubspec.yaml
|
|
run: echo "VERSION=$(grep '^version:' pubspec.yaml | cut -d ' ' -f2 | tr -d '\r')" >> $GITHUB_ENV
|
|
- name: Create GitHub Release
|
|
id: create_release
|
|
uses: ncipollo/release-action@v1
|
|
with:
|
|
name: Release v${{ env.VERSION }}
|
|
tag: ${{ env.VERSION }}
|
|
draft: false
|
|
prerelease: false
|
|
generateReleaseNotes: true
|
|
|
|
build_web:
|
|
needs: create_release
|
|
runs-on: ubuntu-latest
|
|
environment: production
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- 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
|
|
- uses: moonrepo/setup-rust@v1
|
|
- run: rustup component add rust-src --toolchain nightly-x86_64-unknown-linux-gnu
|
|
- run: flutter pub get
|
|
- name: Prepare web
|
|
run: ./scripts/prepare-web.sh
|
|
- name: Update Website files
|
|
run: |
|
|
touch .env
|
|
touch assets/.env
|
|
echo "$WEB_APP_ENV" > .env
|
|
echo "$WEB_APP_ENV" > assets/.env
|
|
- name: Build Release Web
|
|
run: |
|
|
flutter config --enable-web
|
|
flutter clean
|
|
flutter pub get
|
|
flutter build web --dart-define=FLUTTER_WEB_CANVASKIT_URL=canvaskit/ --release --source-maps
|
|
- name: Create archive
|
|
run: tar -czf pangeachat-web.tar.gz build/web/
|
|
- name: Upload Web Build
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: Web Build
|
|
path: pangeachat-web.tar.gz
|
|
- name: Upload files for deploy stage
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: web
|
|
path: build/web
|
|
- name: Upload to release
|
|
uses: actions/upload-release-asset@v1
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.PAGES_DEPLOY_TOKEN }}
|
|
with:
|
|
upload_url: ${{ needs.create_release.outputs.upload_url }}
|
|
asset_path: pangeachat-web.tar.gz
|
|
asset_name: pangeachat-web.tar.gz
|
|
asset_content_type: application/gzip
|
|
|
|
build_apk:
|
|
needs: create_release
|
|
runs-on: ubuntu-latest
|
|
environment: production
|
|
env:
|
|
WEB_APP_ENV: ${{ vars.WEB_APP_ENV }}
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- run: cat .github/workflows/versions.env >> $GITHUB_ENV
|
|
- uses: actions/setup-java@v4
|
|
with:
|
|
java-version: ${{ env.JAVA_VERSION }}
|
|
distribution: 'zulu'
|
|
- uses: subosito/flutter-action@v2
|
|
with:
|
|
flutter-version: ${{ env.FLUTTER_VERSION }}
|
|
cache: true
|
|
- name: Set up Android SDK
|
|
if: ${{ env.ACT }} # Only run on local act setups, as GitHub Actions provides the Android SDK on Ubuntu
|
|
uses: android-actions/setup-android@v2
|
|
- name: Set up Ruby
|
|
uses: ruby/setup-ruby@v1
|
|
with:
|
|
ruby-version: '3.3'
|
|
- name: Update env files to selected environment
|
|
run: |
|
|
rm .env
|
|
rm assets/.env
|
|
echo "$WEB_APP_ENV" >> .env
|
|
cp .env assets/.env
|
|
- name: Apply .env patch
|
|
run: git apply ./scripts/enable_mobile_env.patch
|
|
- name: Install Fastlane
|
|
run: gem install fastlane -NV
|
|
- name: Remove Emoji Font
|
|
run: |
|
|
rm -rf fonts/NotoEmoji
|
|
yq -i 'del( .flutter.fonts[] | select(.family == "NotoEmoji") )' pubspec.yaml
|
|
- run: flutter pub get
|
|
- name: Prepare Android Release Build
|
|
env:
|
|
PLAY_STORE_UPLOAD_KEY: ${{ secrets.PLAY_STORE_UPLOAD_KEY }}
|
|
PLAY_STORE_KEYSTORE_KEY_ALIAS: ${{ secrets.PLAY_STORE_KEYSTORE_KEY_ALIAS }}
|
|
PLAY_STORE_KEYSTORE_STORE_PASSWORD: ${{ secrets.PLAY_STORE_KEYSTORE_STORE_PASSWORD }}
|
|
PLAY_STORE_KEYSTORE_KEY_PASSWORD: ${{ secrets.PLAY_STORE_KEYSTORE_KEY_PASSWORD }}
|
|
PLAY_STORE_CONFIG_JSON: ${{ secrets.PLAY_STORE_CONFIG_JSON }}
|
|
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: ${{ needs.create_release.outputs.upload_url }}
|
|
asset_path: build/app/outputs/flutter-apk/app-release.apk
|
|
asset_name: pangeachat.apk
|
|
asset_content_type: application/vnd.android.package-archive
|
|
|
|
# #Pangea
|
|
# build_linux:
|
|
# strategy:
|
|
# matrix:
|
|
# arch: [ x64 ]
|
|
# runs-on: ubuntu-latest
|
|
# needs: create_release
|
|
# steps:
|
|
# - uses: actions/checkout@v4
|
|
# - run: cat .github/workflows/versions.env >> $GITHUB_ENV
|
|
# - 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 libssl-dev libwebkit2gtk-4.1-dev -y
|
|
# - name: Install dependencies for audio-player
|
|
# run: sudo apt-get install libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev
|
|
# - name: Install Flutter
|
|
# run: |
|
|
# git clone --branch ${{ env.FLUTTER_VERSION }} https://github.com/flutter/flutter.git
|
|
# ./flutter/bin/flutter doctor
|
|
# - run: ./flutter/bin/flutter pub get
|
|
# - run: ./flutter/bin/flutter build linux --target-platform linux-${{ matrix.arch }}
|
|
# - name: Create archive
|
|
# run: tar -czf pangeachat-linux-${{ matrix.arch }}.tar.gz -C build/linux/${{ matrix.arch }}/release/bundle/ .
|
|
# - name: Upload to release
|
|
# uses: actions/upload-release-asset@v1
|
|
# env:
|
|
# GITHUB_TOKEN: ${{ secrets.PAGES_DEPLOY_TOKEN }}
|
|
# with:
|
|
# upload_url: ${{ needs.create_release.outputs.upload_url }}
|
|
# asset_path: pangeachat-linux-${{ matrix.arch }}.tar.gz
|
|
# asset_name: pangeachat-linux-${{ matrix.arch }}.tar.gz
|
|
# asset_content_type: application/gzip
|
|
# Pangea#
|
|
|
|
deploy_web:
|
|
runs-on: ubuntu-latest
|
|
needs: build_web
|
|
environment: production
|
|
env:
|
|
WEBAPP_S3_BUCKET: ${{ vars.WEBAPP_S3_BUCKET }}
|
|
CF_DISTRIBUTION_ID: ${{ vars.CF_DISTRIBUTION_ID }}
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- name: Download web
|
|
uses: actions/download-artifact@v4
|
|
with:
|
|
name: web
|
|
path: build/web
|
|
- name: Set up AWS CLI
|
|
uses: aws-actions/configure-aws-credentials@v4
|
|
with:
|
|
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
|
|
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
|
|
aws-region: ${{ secrets.AWS_DEFAULT_REGION }}
|
|
- name: Copy files to the production website with the AWS CLI
|
|
run: |
|
|
aws s3 sync ./build/web s3://$WEBAPP_S3_BUCKET
|
|
- name: AWS CloudFront Invalidation
|
|
run: |
|
|
aws cloudfront create-invalidation --distribution-id $CF_DISTRIBUTION_ID --paths "/*"
|