Skip to content

Release

Release #441

Workflow file for this run

name: Release
on:
schedule:
- cron: "5 5 * * *"
workflow_dispatch:
inputs:
tag_name:
description: "Tag name for release"
required: false
default: nightly
push:
tags:
- v[0-9]+.[0-9]+.[0-9]+
env:
BUNDLE_ID: rs.anni.annix
jobs:
android:
runs-on: ubuntu-latest
steps:
- name: Setup | Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup | Java
uses: actions/setup-java@v2
with:
distribution: "zulu"
java-version: "11"
- name: Setup | Flutter
uses: subosito/flutter-action@v2
with:
channel: stable
cache: true
cache-key: ${{ secrets.FLUTTER_CACHE_KEY }}
- name: Setup | Dependencies
run: flutter pub get
- name: Setup | Android NDK
run: |
# Apply to gradle
mkdir ~/.gradle
echo "ANDROID_NDK=${ANDROID_NDK_ROOT}" >> ~/.gradle/gradle.properties
cat ~/.gradle/gradle.properties
# /usr/include/bits
sudo apt update -y
sudo apt install libc6-dev-i386
# Install rust targets
rustup update
rustup target add \
aarch64-linux-android \
armv7-linux-androideabi \
x86_64-linux-android \
i686-linux-android
# Install cargo-ndk
cargo install cargo-ndk
cd annix
cargo ndk -o ../android/app/src/main/jniLibs build
cd ..
- name: Setup | Keystore
run: |
echo "${{ secrets.ANDROID_KEYSTORE }}" | base64 -d > keystore.jks
echo "${{ secrets.ANDROID_KEYSTORE_PROPERTIES }}" | base64 -d > ./android/keystore.properties
- name: Build | Apk
run: |
flutter build apk --verbose --build-number ${{ github.run_number }}
cp ./build/app/outputs/apk/release/* ./build/app/outputs/apk/
flutter build apk --verbose --split-per-abi --build-number ${{ github.run_number }}
- name: Build | App Bundle
run: flutter build appbundle --release --build-number ${{ github.run_number }}
- name: Deploy | Upload artifacts
uses: actions/upload-artifact@v3
with:
name: annix-android
path: |
./build/app/outputs/apk/**/*.apk
./build/app/outputs/bundle/**/*.aab
retention-days: 1
iOS:
runs-on: macos-12
env:
KEYCHAIN: job-${{ github.job }}-${{ github.run_id }}-${{ github.run_number }}-${{ github.run_attempt }}
steps:
- name: Setup | Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup | Flutter
uses: subosito/flutter-action@v2
with:
channel: stable
cache: true
cache-key: ${{ secrets.FLUTTER_CACHE_KEY }}
- name: Setup | Certificates
uses: apple-actions/import-codesign-certs@v1
with:
keychain: ${{ env.KEYCHAIN }}
p12-file-base64: ${{ secrets.IOS_CERTIFICATES_P12 }}
p12-password: ${{ secrets.IOS_CERTIFICATES_P12_PASSWORD }}
- name: Setup | Provisioning Profiles
uses: apple-actions/download-provisioning-profiles@v1
with:
bundle-id: ${{ env.BUNDLE_ID }}
issuer-id: ${{ secrets.IOS_APPSTORE_CONNECT_API_ISSUER }}
api-key-id: ${{ secrets.IOS_APPSTORE_CONNECT_API_KEY_ID }}
api-private-key: ${{ secrets.IOS_APPSTORE_CONNECT_API_KEY_DATA }}
- name: Setup | Dependencies
run: flutter pub get
- name: Build | iOS
run: |
flutter build ios --release --verbose --build-number ${{ github.run_number }}
xcodebuild -workspace $PWD/ios/Runner.xcworkspace -scheme Runner -sdk iphoneos -configuration Release archive -archivePath $PWD/build/ios/iphoneos/Runner.xcarchive
xcodebuild -exportArchive -archivePath $PWD/build/ios/iphoneos/Runner.xcarchive -exportOptionsPlist $PWD/ios/exportOptions.plist -exportPath $PWD/build/ios/iphoneos/Runner.ipa
- name: Deploy | Upload artifacts
uses: actions/upload-artifact@v3
with:
name: annix-ios
path: ./build/ios/iphoneos/Runner.ipa/*.ipa
retention-days: 1
- name: Post Setup | Delete keychain
if: always()
run: security delete-keychain "${{ env.KEYCHAIN }}".keychain
linux:
runs-on: ubuntu-latest
steps:
- name: Setup | Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup | Flutter
uses: subosito/flutter-action@v2
with:
channel: stable
cache: true
cache-key: ${{ secrets.FLUTTER_CACHE_KEY }}
- name: Setup | Dependencies
run: |
sudo apt update -y
sudo apt install -y libunwind-dev
sudo apt install -y tar clang cmake ninja-build pkg-config libgtk-3-dev make python3-pip python3-setuptools patchelf desktop-file-utils libgdk-pixbuf2.0-dev fakeroot strace fuse libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev libjsoncpp-dev
flutter config --enable-linux-desktop
flutter pub get
- name: Build | Linux
run: |
flutter build linux --verbose
cd build/linux/x64/release/
zip -r annix-linux64.zip bundle
- name: Deploy | Upload artifacts
uses: actions/upload-artifact@v3
with:
name: annix-linux64
path: ./build/linux/x64/release/annix-linux64.zip
retention-days: 1
macOS:
runs-on: macos-11
steps:
- name: Setup | Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup | Flutter
uses: subosito/flutter-action@v2
with:
channel: stable
cache: true
cache-key: ${{ secrets.FLUTTER_CACHE_KEY }}
- name: Setup | Dependencies
run: flutter pub get
- name: Build | macOS
run: |
flutter build macos --verbose --build-number ${{ github.run_number }}
cd build/macos/Build/Products/Release
ditto -c -k --sequesterRsrc --keepParent Annix.app annix-macos.zip
- name: Deploy | Upload artifacts
uses: actions/upload-artifact@v3
with:
name: annix-macos
path: |
./build/macos/Build/Products/Release/annix-macos.zip
retention-days: 1
windows:
runs-on: windows-latest
steps:
- name: Setup | Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup | Flutter
uses: subosito/flutter-action@v2
with:
channel: stable
cache: true
cache-key: ${{ secrets.FLUTTER_CACHE_KEY }}
- name: Setup | Dependencies
run: |
flutter config --enable-windows-desktop
flutter pub get
- name: Build | Windows
run: |
flutter build windows --verbose --build-number ${{ github.run_number }}
cp -r build/windows/runner/Release annix-win64
tar.exe -a -c -f annix-win64.zip annix-win64
- name: Deploy | Upload artifacts
uses: actions/upload-artifact@v3
with:
name: annix-win64
path: |
./annix-win64.zip
retention-days: 1
playstore:
needs: [android]
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- uses: actions/download-artifact@v3
- if: github.event_name == 'workflow_dispatch'
run: echo "TAG_NAME=${{ github.event.inputs.tag_name }}" >> $GITHUB_ENV
- if: github.event_name == 'schedule'
run: echo 'TAG_NAME=nightly' >> $GITHUB_ENV
- if: github.event_name == 'push'
run: |
TAG_NAME=${{ github.ref }}
echo "TAG_NAME=${TAG_NAME#refs/tags/}" >> $GITHUB_ENV
- uses: r0adkll/upload-google-play@v1
with:
serviceAccountJsonPlainText: ${{ secrets.SERVICE_ACCOUNT_JSON }}
packageName: ${{ env.BUNDLE_ID }}
releaseFiles: annix-android/bundle/release/app-release.aab
status: completed
track: internal
testflight:
needs: [iOS]
runs-on: macos-12
env:
APP_STORE_CONNECT_ISSUER_ID: ${{ secrets.IOS_APPSTORE_CONNECT_API_ISSUER }}
APP_STORE_CONNECT_KEY_IDENTIFIER: ${{ secrets.IOS_APPSTORE_CONNECT_API_KEY_ID }}
APP_STORE_CONNECT_PRIVATE_KEY: ${{ secrets.IOS_APPSTORE_CONNECT_API_KEY_DATA }}
steps:
- uses: actions/checkout@v3
- uses: actions/download-artifact@v3
- name: Setup | Codemagic-cli
run: pip3 install codemagic-cli-tools
# https://github.com/actions/runner-images/issues/6507#issuecomment-1301636292
- name: Add Python bin to PATH
run: echo "/Library/Frameworks/Python.framework/Versions/Current/bin" >> $GITHUB_PATH
- if: github.event_name == 'workflow_dispatch'
run: echo "TAG_NAME=${{ github.event.inputs.tag_name }}" >> $GITHUB_ENV
- if: github.event_name == 'schedule'
run: echo 'TAG_NAME=nightly' >> $GITHUB_ENV
- if: github.event_name == 'push'
run: |
TAG_NAME=${{ github.ref }}
echo "TAG_NAME=${TAG_NAME#refs/tags/}" >> $GITHUB_ENV
- name: Upload to testflight
run: |
app-store-connect publish --testflight --beta-group 'GitHub' --path './annix-ios/annix.ipa'
publish:
needs: [android, iOS, linux, macOS, windows]
runs-on: ubuntu-20.04
env:
GH_REPO: ${{ github.repository }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
permissions:
contents: write
steps:
# Must perform checkout first, since it deletes the target directory
# before running, and would therefore delete the downloaded artifacts
- uses: actions/checkout@v3
- uses: actions/download-artifact@v3
- name: Install dependencies
run: sudo apt update && sudo apt install -y gettext-base
- if: github.event_name == 'workflow_dispatch'
run: echo "TAG_NAME=${{ github.event.inputs.tag_name }}" >> $GITHUB_ENV
- if: github.event_name == 'schedule'
run: echo 'TAG_NAME=nightly' >> $GITHUB_ENV
- if: github.event_name == 'push'
run: |
TAG_NAME=${{ github.ref }}
echo "TAG_NAME=${TAG_NAME#refs/tags/}" >> $GITHUB_ENV
- if: env.TAG_NAME == 'nightly'
run: |
(echo 'SUBJECT=Annix development (prerelease) build';
echo 'PRERELEASE=--prerelease') >> $GITHUB_ENV
gh release delete nightly --yes || true
git push origin :nightly || true
- if: env.TAG_NAME != 'nightly'
run: |
(echo 'SUBJECT=Annix release build';
echo 'PRERELEASE=') >> $GITHUB_ENV
gh release delete stable --yes || true
git push origin :stable || true
- name: Publish release
run: |
gh release create $TAG_NAME $PRERELEASE --title "$SUBJECT" --target $GITHUB_SHA annix-android/**/*.apk annix-linux64/* annix-macos/* annix-win64/* annix-ios/*
if [ "$TAG_NAME" != "nightly" ]; then
gh release create stable $PRERELEASE --title "$SUBJECT" --target $GITHUB_SHA annix-android/**/*.apk annix-linux64/* annix-macos/* annix-win64/* annix-ios/*
fi