Release #9
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: Release | |
| on: | |
| push: | |
| branches: | |
| - main | |
| paths: | |
| - "pubspec.yaml" | |
| workflow_dispatch: | |
| inputs: | |
| force: | |
| description: "Force release even if version unchanged" | |
| required: false | |
| default: "false" | |
| type: boolean | |
| permissions: | |
| contents: write | |
| jobs: | |
| check-version: | |
| name: Check Version or Workflow Change | |
| runs-on: ubuntu-latest | |
| outputs: | |
| version: ${{ steps.version.outputs.version }} | |
| version_changed: ${{ steps.check.outputs.changed }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 2 | |
| - name: Get current version | |
| id: version | |
| run: | | |
| VERSION=$(grep '^version:' pubspec.yaml | sed 's/version: //') | |
| echo "version=$VERSION" >> $GITHUB_OUTPUT | |
| - name: Check if version or workflow changed | |
| id: check | |
| run: | | |
| # If manually triggered with force=true, always proceed | |
| if [ "${{ github.event_name }}" == "workflow_dispatch" ] && [ "${{ github.event.inputs.force }}" == "true" ]; then | |
| echo "changed=true" >> $GITHUB_OUTPUT | |
| echo "Manual run with force=true, triggering release" | |
| # If manually triggered without force, check if there's a previous commit to compare | |
| elif [ "${{ github.event_name }}" == "workflow_dispatch" ]; then | |
| if git rev-parse --verify HEAD^ >/dev/null 2>&1; then | |
| if git diff HEAD^ HEAD -- pubspec.yaml | grep -q '^+version:'; then | |
| echo "changed=true" >> $GITHUB_OUTPUT | |
| elif git diff HEAD^ HEAD -- .github/workflows/release.yml | grep -q '.'; then | |
| echo "changed=true" >> $GITHUB_OUTPUT | |
| echo "Workflow file changed, triggering release" | |
| else | |
| echo "changed=false" >> $GITHUB_OUTPUT | |
| echo "Version unchanged. Use 'force' input to trigger release anyway." | |
| fi | |
| else | |
| # No previous commit, proceed with manual run | |
| echo "changed=true" >> $GITHUB_OUTPUT | |
| echo "Manual run on first commit, triggering release" | |
| fi | |
| # Automatic push trigger | |
| else | |
| if git diff HEAD^ HEAD -- pubspec.yaml | grep -q '^+version:'; then | |
| echo "changed=true" >> $GITHUB_OUTPUT | |
| elif git diff HEAD^ HEAD -- .github/workflows/release.yml | grep -q '.'; then | |
| echo "changed=true" >> $GITHUB_OUTPUT | |
| echo "Workflow file changed, triggering release" | |
| else | |
| echo "changed=false" >> $GITHUB_OUTPUT | |
| fi | |
| fi | |
| release: | |
| name: Create Release | |
| runs-on: ubuntu-latest | |
| needs: check-version | |
| if: needs.check-version.outputs.version_changed == 'true' | |
| outputs: | |
| tag_name: ${{ steps.tag.outputs.tag_name }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Create and push tag | |
| id: tag | |
| run: | | |
| git config user.name github-actions | |
| git config user.email github-actions@github.com | |
| VERSION="${{ needs.check-version.outputs.version }}" | |
| TAG_NAME="v${VERSION}" | |
| # Check if tag already exists | |
| if git ls-remote --tags origin | grep -q "refs/tags/${TAG_NAME}$"; then | |
| if [ "${{ github.event_name }}" == "workflow_dispatch" ]; then | |
| # For manual runs, append build number to tag | |
| BUILD_NUM=${{ github.run_number }} | |
| TAG_NAME="${TAG_NAME}-build${BUILD_NUM}" | |
| echo "Tag v${VERSION} already exists. Creating new tag: ${TAG_NAME}" | |
| else | |
| # For automatic runs, tag should not exist if version changed | |
| echo "Error: Tag ${TAG_NAME} already exists but version should have changed" | |
| exit 1 | |
| fi | |
| fi | |
| git tag -a "${TAG_NAME}" -m "Alpha Release ${TAG_NAME}" | |
| git push origin "${TAG_NAME}" | |
| # Set tag name as output for use in release step | |
| echo "tag_name=${TAG_NAME}" >> $GITHUB_OUTPUT | |
| - name: Create GitHub Release | |
| uses: softprops/action-gh-release@v1 | |
| with: | |
| tag_name: ${{ steps.tag.outputs.tag_name }} | |
| name: Dester ${{ steps.tag.outputs.tag_name }} (Alpha) | |
| draft: false | |
| prerelease: true | |
| generate_release_notes: true | |
| body: | | |
| 🚧 **Alpha Development Build** | |
| **Build Information:** | |
| - Commit: ${{ github.sha }} | |
| - Branch: ${{ github.ref_name }} | |
| - Workflow Run: ${{ github.run_number }} | |
| - Build Date: ${{ github.event.head_commit.timestamp }} | |
| **Platform Downloads:** | |
| - **Android**: Download the APK matching your device architecture: | |
| - `arm64-v8a`: Modern 64-bit devices (2017+) - ~30MB | |
| - `armeabi-v7a`: Older 32-bit devices - ~28MB | |
| - `x86_64`: Emulators/Intel devices - ~32MB | |
| - **iOS**: Universal binary for all iOS devices | |
| - **macOS**: Universal binary (Apple Silicon + Intel) - ~103MB | |
| - **Linux**: x64 build - ~32MB | |
| - **Windows**: x64 build - ~25MB | |
| ⚠️ This is an automated alpha release. Expect bugs and breaking changes. | |
| For stable releases, please wait for beta/stable versions. | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| build-android: | |
| name: Build Android | |
| runs-on: ubuntu-latest | |
| needs: [check-version, release] | |
| if: needs.check-version.outputs.version_changed == 'true' | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup Flutter | |
| uses: subosito/flutter-action@v2 | |
| with: | |
| flutter-version: "3.27.0" | |
| channel: "stable" | |
| - name: Install dependencies | |
| run: flutter pub get | |
| - name: Build Split APKs (per architecture) | |
| run: flutter build apk --release --split-per-abi | |
| - name: Rename APKs | |
| run: | | |
| cd build/app/outputs/flutter-apk | |
| mv app-armeabi-v7a-release.apk Dester-${{ needs.check-version.outputs.version }}-alpha-Android-armeabi-v7a.apk | |
| mv app-arm64-v8a-release.apk Dester-${{ needs.check-version.outputs.version }}-alpha-Android-arm64-v8a.apk | |
| mv app-x86_64-release.apk Dester-${{ needs.check-version.outputs.version }}-alpha-Android-x86_64.apk | |
| - name: Upload Split APKs to Release | |
| uses: softprops/action-gh-release@v1 | |
| with: | |
| tag_name: ${{ needs.release.outputs.tag_name }} | |
| files: | | |
| build/app/outputs/flutter-apk/Dester-${{ needs.check-version.outputs.version }}-alpha-Android-armeabi-v7a.apk | |
| build/app/outputs/flutter-apk/Dester-${{ needs.check-version.outputs.version }}-alpha-Android-arm64-v8a.apk | |
| build/app/outputs/flutter-apk/Dester-${{ needs.check-version.outputs.version }}-alpha-Android-x86_64.apk | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| build-ios: | |
| name: Build iOS | |
| runs-on: macos-latest | |
| needs: [check-version, release] | |
| if: needs.check-version.outputs.version_changed == 'true' | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup Flutter | |
| uses: subosito/flutter-action@v2 | |
| with: | |
| flutter-version: "3.27.0" | |
| channel: "stable" | |
| - name: Install dependencies | |
| run: flutter pub get | |
| - name: Build iOS IPA (no codesign) | |
| run: flutter build ipa --release --no-codesign | |
| - name: Rename IPA | |
| run: | | |
| if ls build/ios/ipa/*.ipa 1> /dev/null 2>&1; then | |
| mv build/ios/ipa/*.ipa build/ios/ipa/Dester-${{ needs.check-version.outputs.version }}-alpha-iOS.ipa | |
| else | |
| echo "No IPA found, creating archive from .app" | |
| cd build/ios/archive/Runner.xcarchive/Products/Applications | |
| zip -r Dester-${{ needs.check-version.outputs.version }}-alpha-iOS.zip Runner.app | |
| mkdir -p ../../../../ipa | |
| mv Dester-${{ needs.check-version.outputs.version }}-alpha-iOS.zip ../../../../ipa/Dester-${{ needs.check-version.outputs.version }}-alpha-iOS.ipa | |
| fi | |
| - name: Upload IPA to Release | |
| uses: softprops/action-gh-release@v1 | |
| with: | |
| tag_name: ${{ needs.release.outputs.tag_name }} | |
| files: build/ios/ipa/Dester-${{ needs.check-version.outputs.version }}-alpha-iOS.ipa | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| build-macos: | |
| name: Build macOS | |
| runs-on: macos-latest | |
| needs: [check-version, release] | |
| if: needs.check-version.outputs.version_changed == 'true' | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup Flutter | |
| uses: subosito/flutter-action@v2 | |
| with: | |
| flutter-version: "3.27.0" | |
| channel: "stable" | |
| - name: Install dependencies | |
| run: flutter pub get | |
| - name: Build macOS | |
| run: flutter build macos --release | |
| - name: Create ZIP archive | |
| run: | | |
| cd build/macos/Build/Products/Release | |
| zip -r Dester-${{ needs.check-version.outputs.version }}-macOS.zip dester.app | |
| - name: Upload macOS build | |
| uses: softprops/action-gh-release@v1 | |
| with: | |
| tag_name: ${{ needs.release.outputs.tag_name }} | |
| files: build/macos/Build/Products/Release/Dester-${{ needs.check-version.outputs.version }}-macOS.zip | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| build-linux: | |
| name: Build Linux | |
| runs-on: ubuntu-latest | |
| needs: [check-version, release] | |
| if: needs.check-version.outputs.version_changed == 'true' | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Install dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y clang cmake ninja-build pkg-config libgtk-3-dev libasound2-dev libmpv-dev | |
| - name: Setup Flutter | |
| uses: subosito/flutter-action@v2 | |
| with: | |
| flutter-version: "3.27.0" | |
| channel: "stable" | |
| - name: Install Flutter dependencies | |
| run: flutter pub get | |
| - name: Build Linux | |
| run: flutter build linux --release | |
| - name: Create archive | |
| run: | | |
| cd build/linux/x64/release/bundle | |
| tar -czf Dester-${{ needs.check-version.outputs.version }}-Linux.tar.gz * | |
| - name: Upload Linux build | |
| uses: softprops/action-gh-release@v1 | |
| with: | |
| tag_name: ${{ needs.release.outputs.tag_name }} | |
| files: build/linux/x64/release/bundle/Dester-${{ needs.check-version.outputs.version }}-Linux.tar.gz | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| build-windows: | |
| name: Build Windows | |
| runs-on: windows-latest | |
| needs: [check-version, release] | |
| if: needs.check-version.outputs.version_changed == 'true' | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup Flutter | |
| uses: subosito/flutter-action@v2 | |
| with: | |
| flutter-version: "3.27.0" | |
| channel: "stable" | |
| - name: Install dependencies | |
| run: flutter pub get | |
| - name: Build Windows | |
| run: flutter build windows --release | |
| - name: Create archive | |
| run: | | |
| Compress-Archive -Path build\windows\x64\runner\Release\* -DestinationPath Dester-${{ needs.check-version.outputs.version }}-Windows.zip | |
| - name: Upload Windows build | |
| uses: softprops/action-gh-release@v1 | |
| with: | |
| tag_name: ${{ needs.release.outputs.tag_name }} | |
| files: Dester-${{ needs.check-version.outputs.version }}-Windows.zip | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |