build: emptying cl #48
Workflow file for this run
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: Build and Release AnymeX | |
on: | |
push: | |
tags: | |
- "v*" | |
workflow_dispatch: | |
jobs: | |
generate-changelog: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Generate Changelog | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
#!/bin/bash | |
# Determine Previous and Current Tags | |
PREVIOUS_TAG=$(git tag --sort=-v:refname | grep -vE '(-alpha|-beta|-rc)' | head -n 2 | tail -n 1) | |
CURRENT_TAG=${GITHUB_REF#refs/tags/} | |
# Default to the initial commit if no previous tag exists | |
if [ -z "$PREVIOUS_TAG" ]; then | |
PREVIOUS_TAG=$(git rev-list --max-parents=0 HEAD) | |
fi | |
echo "Previous Tag: $PREVIOUS_TAG" | |
echo "Current Tag: $CURRENT_TAG" | |
# Check if there are any commits between the tags | |
if [ -z "$(git log $PREVIOUS_TAG..$CURRENT_TAG --oneline)" ]; then | |
echo "No commits found between $PREVIOUS_TAG and $CURRENT_TAG." | |
exit 0 | |
fi | |
# Initialize Changelog | |
echo "# Changelog" > CHANGELOG.md | |
echo "## $CURRENT_TAG" >> CHANGELOG.md | |
echo "" >> CHANGELOG.md | |
# Define Commit Types | |
declare -A SECTIONS=( | |
["🎉 New Features"]="^feat" | |
["🛠️ Bug Fixes & Improvements"]="^(fix|bug|improvement|patch)" | |
["🔧 Refactors"]="^refactor" | |
["🎨 Style Changes"]="^style" | |
["🚀 Performance Improvements"]="^perf" | |
["🧹 Chores & Documentation"]="^(chore|docs|build|ci)" | |
) | |
# Generate Sections | |
for SECTION in "${!SECTIONS[@]}"; do | |
echo "## $SECTION:" >> CHANGELOG.md | |
git log $PREVIOUS_TAG..$CURRENT_TAG --grep="${SECTIONS[$SECTION]}" --pretty=format:'* [`%h`](https://github.com/RyanYuuki/AnymeX/commit/%h): %s' >> CHANGELOG.md | |
echo "" >> CHANGELOG.md | |
done | |
cat CHANGELOG.md | |
- name: Commit and push changelog | |
run: | | |
git config --global user.name "GitHub Actions" | |
git config --global user.email "[email protected]" | |
git add CHANGELOG.md | |
git commit -m "Update changelog for version $CURRENT_TAG" | |
git push origin HEAD:main | |
- name: Update Release with Changelog | |
uses: ncipollo/release-action@v1 | |
with: | |
bodyFile: "CHANGELOG.md" | |
token: ${{ secrets.GITHUB_TOKEN }} | |
allowUpdates: true | |
build-android: | |
runs-on: ubuntu-latest | |
needs: generate-changelog | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v3 | |
- name: Setup Java | |
uses: actions/setup-java@v3 | |
with: | |
distribution: "adopt" | |
java-version: "17" | |
- name: Setup Flutter | |
uses: subosito/flutter-action@v2 | |
with: | |
flutter-version: "3.22.3" | |
- name: Get Dependencies | |
run: flutter pub get | |
- name: Build Android with Split ABI | |
run: flutter build apk --split-per-abi | |
- name: Rename APKs | |
run: | | |
mv build/app/outputs/flutter-apk/app-armeabi-v7a-release.apk build/app/outputs/flutter-apk/AnymeX-Android-armeabi-v7a.apk | |
mv build/app/outputs/flutter-apk/app-arm64-v8a-release.apk build/app/outputs/flutter-apk/AnymeX-Android-arm64.apk | |
mv build/app/outputs/flutter-apk/app-x86_64-release.apk build/app/outputs/flutter-apk/AnymeX-Android-x86_64.apk | |
- name: Build Universal APK | |
run: flutter build apk --release | |
- name: Rename Universal APK | |
run: mv build/app/outputs/flutter-apk/app-release.apk build/app/outputs/flutter-apk/AnymeX-Android-universal.apk | |
- name: Release Android APKs | |
uses: ncipollo/release-action@v1 | |
with: | |
artifacts: "build/app/outputs/flutter-apk/AnymeX-Android-*.apk" | |
token: ${{ secrets.GITHUB_TOKEN }} | |
allowUpdates: true | |
tag: ${{ github.ref_name }} | |
build-ios: | |
runs-on: macos-latest | |
needs: generate-changelog | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v3 | |
- name: Setup Flutter | |
uses: subosito/flutter-action@v2 | |
with: | |
flutter-version: "3.22.3" | |
- name: Get Dependencies | |
run: flutter pub get | |
- name: Build iOS | |
run: | | |
flutter build ios --release --no-codesign | |
cd build/ios/iphoneos | |
mkdir -p Payload | |
cd Payload | |
ln -s ../Runner.app | |
cd .. | |
zip -r AnymeX-iOS-${{ github.ref_name }}.ipa Payload | |
mv AnymeX-iOS-${{ github.ref_name }}.ipa ../../../ | |
- name: Release iOS IPA | |
uses: ncipollo/release-action@v1 | |
with: | |
artifacts: "AnymeX-iOS-*.ipa" | |
token: ${{ secrets.GITHUB_TOKEN }} | |
allowUpdates: true | |
tag: ${{ github.ref_name }} | |
build-linux: | |
runs-on: ubuntu-latest | |
needs: generate-changelog | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v3 | |
- name: Install Dependencies | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y ninja-build cmake g++ libgtk-3-dev libblkid-dev liblzma-dev pkg-config libmpv-dev libwebkit2gtk-4.1-dev | |
- name: Setup Flutter | |
uses: subosito/flutter-action@v2 | |
with: | |
flutter-version: "3.22.3" | |
- name: Replace pubspec.yaml with Desktop Version | |
run: cp pubspec_desktop.yaml pubspec.yaml | |
- name: Get Dependencies | |
run: flutter pub get | |
- name: Replace video file extensions for desktops | |
run: | | |
mv lib/pages/Desktop/video_controls.darts lib/pages/Desktop/video_controls.dart | |
mv lib/pages/Desktop/watch_page.darts lib/pages/Desktop/watch_page.dart | |
- name: Replace main.dart with Desktop Version | |
run: mv lib/main.darts lib/main.dart | |
- name: Build Linux | |
run: flutter build linux --release | |
- name: Zip Linux Artifacts | |
run: | | |
cd build/linux/x64/release/bundle | |
zip -r ../../../../../AnymeX-Linux.zip . | |
- name: Release Linux Build | |
uses: ncipollo/release-action@v1 | |
with: | |
artifacts: "AnymeX-Linux.zip" | |
token: ${{ secrets.GITHUB_TOKEN }} | |
allowUpdates: true | |
tag: ${{ github.ref_name }} | |
build-windows: | |
runs-on: windows-latest | |
needs: generate-changelog | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v3 | |
- name: Setup Flutter | |
uses: subosito/flutter-action@v2 | |
with: | |
flutter-version: "3.22.3" | |
- name: Replace pubspec.yaml with Desktop Version | |
run: Copy-Item -Path pubspec_desktop.yaml -Destination pubspec.yaml -Force | |
- name: Replace main.dart with Desktop Version | |
run: Move-Item -Path lib\main.darts -Destination lib\main.dart -Force | |
- name: Replace video file extensions for desktops | |
run: | | |
Move-Item -Path lib\pages\Desktop\video_controls.darts -Destination lib\pages\Desktop\video_controls.dart -Force | |
Move-Item -Path lib\pages\Desktop\watch_page.darts -Destination lib\pages\Desktop\watch_page.dart -Force | |
- name: Get Dependencies | |
run: flutter pub get | |
- name: Build Windows | |
run: flutter build windows --release | |
- name: Create ZIP file for Windows Build | |
run: | | |
cd build/windows/x64/runner/Release | |
Compress-Archive -Path * -DestinationPath AnymeX-Windows.zip | |
- name: Setup Inno Setup | |
run: choco install innosetup -y | |
- name: Build Installer with Inno Setup | |
run: | | |
& "C:\Program Files (x86)\Inno Setup 6\ISCC.exe" inno.iss | |
- name: Release Windows Builds | |
uses: ncipollo/release-action@v1 | |
with: | |
artifacts: "build/windows/x64/runner/Release/AnymeX-Windows.zip,output/AnymeX-Setup.exe" | |
token: ${{ secrets.GITHUB_TOKEN }} | |
allowUpdates: true | |
tag: ${{ github.ref_name }} | |
build-macos: | |
runs-on: macos-latest | |
needs: generate-changelog | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v3 | |
- name: Setup Flutter | |
uses: subosito/flutter-action@v2 | |
with: | |
flutter-version: "3.22.3" | |
- name: Replace pubspec.yaml with Desktop Version | |
run: cp pubspec_macos.yaml pubspec.yaml | |
- name: Replace main.dart with Desktop Version | |
run: mv lib/main.darts lib/main.dart | |
- name: Replace video file extensions for desktops | |
run: | | |
mv lib/pages/Desktop/video_controls.darts lib/pages/Desktop/video_controls.dart | |
mv lib/pages/Desktop/watch_page.darts lib/pages/Desktop/watch_page.dart | |
mv lib/auth/auth_provider_macos.dart lib/auth/auth_provider.dart | |
- name: Get Dependencies | |
run: flutter pub get | |
- name: Build macOS | |
run: flutter build macos --release | |
- name: Create DMG file for macOS Build | |
run: | | |
mkdir -p build/macos/Release | |
hdiutil create -volname "AnymeX" -srcfolder build/macos/Build/Products/Release/AnymeX.app -ov -format UDZO build/macos/Release/AnymeX.dmg | |
- name: Release macOS Builds | |
uses: ncipollo/release-action@v1 | |
with: | |
artifacts: "build/macos/Release/AnymeX.dmg" | |
token: ${{ secrets.GITHUB_TOKEN }} | |
allowUpdates: true | |
tag: ${{ github.ref_name }} |