fluffychat/.github/workflows/release.yaml

203 lines
7.3 KiB
YAML
Raw Normal View History

2023-07-15 00:37:55 +00:00
name: Release Workflow
on:
release:
types:
- created
concurrency:
group: release_workflow
cancel-in-progress: true
env:
FLUTTER_VERSION: ${{ secrets.FLUTTER_VERSION }}
JAVA_VERSION: ${{ secrets.JAVA_VERSION }}
jobs:
build_web:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-java@v1
with:
java-version: ${{ env.JAVA_VERSION }}
- uses: subosito/flutter-action@v2
with:
flutter-version: ${{ env.FLUTTER_VERSION }}
- 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 --verbose --source-maps
- name: Create archive
run: tar -czf fluffychat-web-${{ github.ref }}.tar.gz build/web/
build_apk:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-java@v1
with:
java-version: ${{ env.JAVA_VERSION }}
- uses: subosito/flutter-action@v2
with:
flutter-version: ${{ env.FLUTTER_VERSION }}
- 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
build_linux:
runs-on: ubuntu-latest
strategy:
matrix:
arch: [x64, arm64]
steps:
- uses: actions/checkout@v2
- uses: actions/setup-java@v1
with:
java-version: ${{ env.JAVA_VERSION }}
- uses: subosito/flutter-action@v2
with:
flutter-version: ${{ env.FLUTTER_VERSION }}
- 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
- name: Create archive
run: tar -czf fluffychat-linux-${{ matrix.architecture }}-${{ github.ref }}.tar.gz build/linux/${{ matrix.architecture }}/release/bundle/
promote_snapcraft:
2023-07-15 00:58:36 +00:00
runs-on: ubuntu-latest
env:
SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.SNAPCRAFT_TOKEN }}
steps:
- name: Check out Git repository
uses: actions/checkout@v3
- name: Install Snapcraft with LXD
uses: samuelmeuli/action-snapcraft@v2
with:
use_lxd: ${{ matrix.os == 'ubuntu-18.04' }}
2023-07-15 00:58:36 +00:00
- name: Promote Snap
env:
SNAPCRAFT_TOKEN: ${{ secrets.SNAPCRAFT_TOKEN }}
2023-07-15 00:58:36 +00:00
run: |
echo "${{ SNAPCRAFT_TOKEN }}" >> snapcrafttoken.txt
snapcraft login --with snapcrafttoken.txt
2023-07-15 00:58:36 +00:00
RELEASE_TYPE=$(echo "${{ github.ref }}" | awk -F"/" '{print $3}')
if [ "$RELEASE_TYPE" = "rc" ]; then
snapcraft promote fluffychat --from-channel edge --to-channel candidate
else
snapcraft promote fluffychat --from-channel edge --to-channel stable
fi
2023-07-15 00:37:55 +00:00
deploy_playstore:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-java@v1
with:
java-version: ${{ env.JAVA_VERSION }}
- uses: subosito/flutter-action@v2
with:
flutter-version: ${{ env.FLUTTER_VERSION }}
- 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: Deploy Android Release
run: |
mkdir -p build/android
cp build/app/outputs/bundle/release/app-release.aab build/android/
cd android
bundle install
bundle update fastlane
RELEASE_TYPE=$(echo "${{ github.ref }}" | awk -F"/" '{print $3}')
if [ "$RELEASE_TYPE" = "rc" ]; then
bundle exec fastlane deploy_candidate
else
bundle exec fastlane deploy_release
fi
cd ..
release:
needs: [build_linux, build_web, build_apk]
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v2
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: false
prerelease: false
- name: Upload Linux (x64) Build
uses: actions/upload-artifact@v2
with:
name: Linux Build
path: fluffychat-linux-x64-${{ github.ref }}.tar.gz
- name: Upload Linux (arm64) Build
uses: actions/upload-artifact@v2
with:
name: Linux Build
path: fluffychat-linux-arm64-${{ github.ref }}.tar.gz
- name: Upload Web Build
uses: actions/upload-artifact@v2
with:
name: Web Build
path: fluffychat-web-${{ github.ref }}.tar.gz
- name: Upload APK Build
uses: actions/upload-artifact@v2
with:
name: APK Build
path: build/app/outputs/apk/release/app-release.apk
- name: Get Release URL
id: get_release_url
run: echo "::set-output name=url::$(echo ${{ github.event.repository.html_url }}/releases/tag/${{ github.ref }})"
- name: Add Download Links to Release Description
run: |
echo "Download the built artifacts from the following links:" >> release_description.txt
echo "- Linux(x64): [Download](${{ needs.build_linux.outputs.artifact_url }})" >> release_description.txt
echo "- Linux(arm64): [Download](${{ needs.build_linux.outputs.artifact_url }})" >> release_description.txt
echo "- Web: [Download](${{ needs.build_web.outputs.artifact_url }})" >> release_description.txt
echo "- APK: [Download](${{ needs.build_apk.outputs.artifact_url }})" >> release_description.txt
cat release_description.txt | gh release upload ${{ github.ref }} -
- name: Publish 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: release_description.txt
asset_name: release_description.txt
asset_content_type: text/plain