Add mild outline to timer circle #48
This file contains hidden or 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: Build and Deploy | |
on: | |
push: | |
branches: [main] | |
paths-ignore: | |
- "pubspec.yaml" | |
- "fastlane/metadata/**" | |
- "assets/changelogs/**" | |
workflow_dispatch: | |
permissions: | |
contents: write | |
pages: write | |
id-token: write | |
env: | |
PUB_SUMMARY_ONLY: true | |
KOTLIN_VERSION: "2.1.0" | |
jobs: | |
version-and-prepare: | |
runs-on: ubuntu-latest | |
outputs: | |
version: ${{ steps.version.outputs.version }} | |
flutter_version: ${{ steps.version.outputs.flutter_version }} | |
msix_version: ${{ steps.version.outputs.msix_version }} | |
changelog_number: ${{ steps.version.outputs.changelog_number }} | |
changelog: ${{ steps.changelog.outputs.changelog }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Install yq | |
run: | | |
sudo wget -qO /usr/local/bin/yq https://github.com/mikefarah/yq/releases/latest/download/yq_linux_amd64 | |
sudo chmod +x /usr/local/bin/yq | |
- name: Calculate new version | |
id: version | |
run: | | |
current_version=$(yq e '.version' pubspec.yaml) | |
IFS='+.' read -r major minor patch build_number <<< "$current_version" | |
new_patch=$((patch + 1)) | |
new_build_number=$((build_number + 1)) | |
changelog_number=$((new_build_number * 10 + 3)) | |
new_flutter_version="$major.$minor.$new_patch+$new_build_number" | |
new_version="$major.$minor.$new_patch" | |
current_msix_version=$(yq e '.msix_config.msix_version' pubspec.yaml) | |
IFS='.' read -r msix_major msix_minor msix_patch msix_zero <<< "$current_msix_version" | |
new_msix_patch=$((msix_patch + 1)) | |
new_msix_version="$msix_major.$msix_minor.$new_msix_patch.$msix_zero" | |
echo "version=$new_version" >> $GITHUB_OUTPUT | |
echo "flutter_version=$new_flutter_version" >> $GITHUB_OUTPUT | |
echo "msix_version=$new_msix_version" >> $GITHUB_OUTPUT | |
echo "changelog_number=$changelog_number" >> $GITHUB_OUTPUT | |
- name: Generate changelog | |
id: changelog | |
run: | | |
changelog_file="fastlane/metadata/android/en-US/changelogs/${{ steps.version.outputs.changelog_number }}.txt" | |
mkdir -p "$(dirname "$changelog_file")" | |
last_tag=$(git describe --tags --abbrev=0 2>/dev/null || echo "") | |
git --no-pager log --pretty=format:'%s' "$last_tag"..HEAD | \ | |
sort -u | \ | |
grep -v "^Merge " | \ | |
grep -v "^Release " | \ | |
grep -v "^${{ steps.version.outputs.version }}" | \ | |
grep -v "^Bump " | \ | |
grep -v "^Update " | \ | |
head -10 | \ | |
awk '{print "• "$0}' > "$changelog_file" | |
cat "$changelog_file" | |
changelog=$(cat "$changelog_file") | |
echo "changelog<<EOF" >> $GITHUB_OUTPUT | |
echo "$changelog" >> $GITHUB_OUTPUT | |
echo "EOF" >> $GITHUB_OUTPUT | |
mkdir -p fastlane/metadata/en-AU | |
echo "$changelog" > fastlane/metadata/en-AU/release_notes.txt | |
- name: Setup Flutter from submodule | |
run: | | |
git submodule update --init --recursive flutter | |
chmod +x flutter/bin/* | |
echo "${{ github.workspace }}/flutter/bin" >> $GITHUB_PATH | |
flutter/bin/flutter config --no-analytics | |
- name: Run tests and analysis | |
run: | | |
flutter test | |
dart analyze lib | |
dart format --set-exit-if-changed lib | |
- name: Update versions in pubspec.yaml | |
run: | | |
yq e ".version |= \"${{ steps.version.outputs.flutter_version }}\"" -i pubspec.yaml | |
yq e ".msix_config.msix_version |= \"${{ steps.version.outputs.msix_version }}\"" -i pubspec.yaml | |
- name: Copy changelogs with timestamps | |
run: | | |
mkdir -p assets/changelogs | |
for file in fastlane/metadata/android/en-US/changelogs/*.txt; do | |
[ -f "$file" ] || continue | |
timestamp=$(stat --format="%W" "$file") | |
target_file="assets/changelogs/$timestamp.txt" | |
cp "$file" "$target_file" | |
echo "Copied $(basename "$file") to $timestamp.txt" | |
done | |
- name: Setup Java | |
uses: actions/setup-java@v4 | |
with: | |
distribution: "zulu" | |
java-version: "17" | |
- name: Setup Android SDK | |
uses: android-actions/setup-android@v3 | |
- name: Accept Android SDK licenses | |
run: yes | flutter doctor --android-licenses | |
- name: Enable KVM group perms | |
run: | | |
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules | |
sudo udevadm control --reload-rules | |
sudo udevadm trigger --name-match=kvm | |
- name: Generate Android screenshots | |
uses: reactivecircus/android-emulator-runner@v2 | |
env: | |
FLEXIFY_DEVICE_TYPE: phoneScreenshots | |
with: | |
api-level: 30 | |
target: google_apis | |
arch: x86_64 | |
profile: pixel_5 | |
avd-name: phoneScreenshots | |
emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none | |
disable-animations: true | |
script: | | |
flutter drive --profile --driver=test_driver/integration_test.dart --target=integration_test/screenshot_test.dart --dart-define=FLEXIFY_DEVICE_TYPE=phoneScreenshots -d emulator-5554 | |
- name: Commit version bump, screenshots and create tag | |
run: | | |
git config --local user.email "[email protected]" | |
git config --local user.name "GitHub Action" | |
git add pubspec.yaml fastlane/metadata fastlane/screenshots pubspec.lock assets | |
git commit -m "Release ${{ steps.version.outputs.version }}" | |
git tag "${{ steps.version.outputs.version }}" | |
git push origin main | |
git push origin "${{ steps.version.outputs.version }}" | |
build-android: | |
needs: [version-and-prepare] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Setup Java | |
uses: actions/setup-java@v4 | |
with: | |
distribution: "zulu" | |
java-version: "17" | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
ref: main | |
token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Create brandon user directory structure (match F-Droid) | |
run: | | |
sudo mkdir -p /home/brandon | |
sudo chown $USER -R /home/brandon | |
- name: Move project to F-Droid location | |
run: | | |
cd .. | |
mv ${{ github.event.repository.name }} /home/brandon/flexify | |
- name: Setup Flutter from submodule and get dependencies | |
working-directory: /home/brandon/flexify | |
run: | | |
git submodule update --init --recursive flutter | |
chmod +x flutter/bin/* | |
echo "/home/brandon/flexify/flutter/bin" >> $GITHUB_PATH | |
export PUB_CACHE=$(pwd)/.pub-cache | |
flutter/bin/flutter config --no-analytics | |
flutter/bin/flutter pub get | |
- name: Decode Android keystore | |
working-directory: /home/brandon/flexify | |
run: | | |
echo "${{ secrets.ANDROID_KEYSTORE_BASE64 }}" | base64 --decode > android/app/keystore.jks | |
- name: Build android | |
working-directory: /home/brandon/flexify | |
run: | | |
echo "storePassword=${{ secrets.ANDROID_STORE_PASSWORD }}" > android/key.properties | |
echo "keyPassword=${{ secrets.ANDROID_KEY_PASSWORD }}" >> android/key.properties | |
echo "keyAlias=${{ secrets.ANDROID_KEY_ALIAS }}" >> android/key.properties | |
echo "storeFile=keystore.jks" >> android/key.properties | |
flutter build apk --split-per-abi | |
flutter build apk | |
mv build/app/outputs/flutter-apk/app-release.apk build/app/outputs/flutter-apk/flexify.apk | |
flutter build appbundle | |
mkdir -p "${GITHUB_WORKSPACE}/build" | |
mv build/* "${GITHUB_WORKSPACE}/build" | |
- name: Upload Android artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: android-builds | |
path: | | |
build/app/outputs/flutter-apk/app-*-release.apk | |
build/app/outputs/flutter-apk/flexify.apk | |
build/app/outputs/bundle/release/app-release.aab | |
build-linux: | |
needs: [version-and-prepare] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
ref: main | |
token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Setup Flutter from submodule | |
run: | | |
git submodule update --init --recursive flutter | |
chmod +x flutter/bin/* | |
echo "${{ github.workspace }}/flutter/bin" >> $GITHUB_PATH | |
flutter/bin/flutter config --no-analytics | |
- name: Get Flutter dependencies | |
run: flutter pub get | |
- name: Install Linux dependencies | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y clang cmake ninja-build pkg-config libgtk-3-dev liblzma-dev libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev | |
- name: Build Linux | |
run: flutter build linux | |
- name: Create Linux zip | |
run: | | |
cd build/linux/x64/release/bundle | |
zip -r flexify-linux.zip . | |
- name: Upload Linux artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: linux-builds | |
path: build/linux/x64/release/bundle/flexify-linux.zip | |
build-windows: | |
needs: [version-and-prepare] | |
runs-on: windows-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
ref: main | |
token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Setup Flutter from submodule | |
run: | | |
git submodule update --init --recursive flutter | |
chmod +x flutter/bin/* | |
echo "${{ github.workspace }}\flutter\bin" >> $env:GITHUB_PATH | |
flutter\bin\flutter config --no-analytics | |
- name: Get Flutter dependencies | |
run: flutter pub get | |
- name: Build Windows | |
run: flutter build windows | |
- name: Create Windows zip | |
run: | | |
Compress-Archive -Path ./build/windows/x64/runner/Release/* -DestinationPath ./flexify-windows.zip | |
- name: Upload Windows artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: windows-builds | |
path: | | |
flexify-windows.zip | |
build-and-deploy-web: | |
needs: [version-and-prepare] | |
runs-on: ubuntu-latest | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
ref: main | |
token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Setup Flutter from submodule | |
run: | | |
git submodule update --init --recursive flutter | |
chmod +x flutter/bin/* | |
echo "${{ github.workspace }}/flutter/bin" >> $GITHUB_PATH | |
flutter/bin/flutter config --no-analytics | |
- name: Get Flutter dependencies | |
run: flutter pub get | |
- name: Enable web support | |
run: flutter config --enable-web | |
- name: Build Flutter web | |
run: | | |
flutter build web --release --base-href /${{ github.event.repository.name }}/ | |
- name: Setup Pages | |
uses: actions/configure-pages@v4 | |
- name: Upload to GitHub Pages | |
uses: actions/upload-pages-artifact@v3 | |
with: | |
path: ./build/web | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v4 | |
create-github-release: | |
needs: [version-and-prepare, build-android, build-linux, build-windows] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
ref: main | |
- name: Download all artifacts | |
uses: actions/download-artifact@v4 | |
- name: Create GitHub Release | |
uses: softprops/action-gh-release@v1 | |
with: | |
tag_name: ${{ needs.version-and-prepare.outputs.version }} | |
name: ${{ needs.version-and-prepare.outputs.version }} | |
body: ${{ needs.version-and-prepare.outputs.changelog }} | |
files: | | |
android-builds/flutter-apk/app-*-release.apk | |
android-builds/flutter-apk/flexify.apk | |
linux-builds/flexify-linux.zip | |
windows-builds/flexify-windows.zip | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
deploy-windows-store: | |
needs: [build-windows] | |
runs-on: windows-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
ref: main | |
- name: Setup Flutter from submodule | |
run: | | |
git submodule update --init --recursive flutter | |
chmod +x flutter/bin/* | |
echo "${{ github.workspace }}\flutter\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append | |
flutter\bin\flutter config --no-analytics | |
- name: Get Flutter dependencies | |
run: flutter pub get | |
- name: Build MSIX | |
run: flutter pub run msix:create | |
- name: Setup .NET 9.0 | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: "9.0.x" | |
- name: Setup Microsoft Store CLI | |
uses: microsoft/setup-msstore-cli@v1 | |
- name: Configure Microsoft Store CLI | |
run: | | |
msstore reconfigure --tenantId ${{ secrets.AZURE_TENANT_ID }} --clientId ${{ secrets.AZURE_CLIENT_ID }} --clientSecret ${{ secrets.CLIENT_SECRET }} --sellerId ${{ secrets.SELLER_ID }} | |
- name: Publish to Microsoft Store | |
run: | | |
msstore publish build/windows/x64/runner/Release/flexify.msix --inputDirectory build/windows/x64/runner/Release --appId ${{ secrets.PRODUCT_ID }} |