name: Spotube Release Binary on: workflow_dispatch: inputs: version: description: Version to release (x.x.x) default: 3.5.0 required: true channel: type: choice description: Release Channel required: true options: - stable - nightly default: nightly debug: description: Debug on failed when channel is nightly required: true type: boolean default: false dry_run: description: Dry run required: true type: boolean default: true env: FLUTTER_VERSION: '3.19.1' jobs: windows: runs-on: windows-latest steps: - uses: actions/checkout@v4 - uses: subosito/flutter-action@v2.12.0 with: cache: true flutter-version: ${{ env.FLUTTER_VERSION }} - name: Replace pubspec version and BUILD_VERSION Env (nightly) if: ${{ inputs.channel == 'nightly' }} run: | choco install sed make yq -y yq -i '.version |= sub("\+\d+", "+${{ inputs.channel }}.")' pubspec.yaml yq -i '.version += strenv(GITHUB_RUN_NUMBER)' pubspec.yaml "BUILD_VERSION=${{ inputs.version }}+${{ inputs.channel }}.${{ github.run_number }}" >> $env:GITHUB_ENV - name: Replace version in files run: | choco install sed make -y sed -i "s/%{{SPOTUBE_VERSION}}%/${{ env.BUILD_VERSION }}/" windows/runner/Runner.rc sed -i "s/%{{SPOTUBE_VERSION}}%/${{ env.BUILD_VERSION }}/" choco-struct/tools/VERIFICATION.txt sed -i "s/%{{SPOTUBE_VERSION}}%/${{ env.BUILD_VERSION }}/" choco-struct/spotube.nuspec - name: Create Nightly .env if: ${{ inputs.channel == 'nightly' }} run: echo '${{ secrets.DOTENV_NIGHTLY }}' > .env - name: Generating Secrets run: | flutter config --enable-windows-desktop flutter pub get dart run build_runner build --delete-conflicting-outputs --enable-experiment=records,patterns - name: Build Windows Executable run: | dart pub global activate flutter_distributor make innoinstall flutter_distributor package --platform=windows --targets=exe --skip-clean mv dist/**/spotube-*-windows-setup.exe dist/Spotube-windows-x86_64-setup.exe - name: Upload Artifact uses: actions/upload-artifact@v3 with: if-no-files-found: error name: Spotube-Release-Binaries path: | dist/Spotube-windows-x86_64.nupkg dist/Spotube-windows-x86_64-setup.exe - name: Debug With SSH When fails if: ${{ failure() && inputs.debug && inputs.channel == 'nightly' }} uses: mxschmitt/action-tmate@v3 with: limit-access-to-actor: true android: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: subosito/flutter-action@v2.12.0 with: cache: true flutter-version: ${{ env.FLUTTER_VERSION }} - name: Install Dependencies run: | sudo apt-get update -y sudo apt-get install -y 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 xmlstarlet - name: Replace pubspec version and BUILD_VERSION Env (nightly) if: ${{ inputs.channel == 'nightly' }} run: | curl -sS https://webi.sh/yq | sh yq -i '.version |= sub("\+\d+", "+${{ inputs.channel }}.")' pubspec.yaml yq -i '.version += strenv(GITHUB_RUN_NUMBER)' pubspec.yaml echo "BUILD_VERSION=${{ inputs.version }}+${{ inputs.channel }}.${{ github.run_number }}" >> $GITHUB_ENV - name: Create Nightly .env if: ${{ inputs.channel == 'nightly' }} run: echo '${{ secrets.DOTENV_NIGHTLY }}' > .env - name: Generate Secrets run: | flutter pub get dart run build_runner build --delete-conflicting-outputs --enable-experiment=records,patterns - name: Build Apk run: | flutter build apk --flavor ${{ inputs.channel }} mv build/app/outputs/flutter-apk/app-${{ inputs.channel }}-release.apk build/Spotube-android-all-arch.apk - uses: actions/upload-artifact@v3 with: if-no-files-found: error name: Spotube-Release-Binaries path: | build/Spotube-android-all-arch.apk build/Spotube-playstore-all-arch.aab - name: Debug With SSH When fails if: ${{ failure() && inputs.debug && inputs.channel == 'nightly' }} uses: mxschmitt/action-tmate@v3 with: limit-access-to-actor: true upload: runs-on: ubuntu-latest needs: - windows - linux - android - macos steps: - uses: actions/download-artifact@v3 with: name: Spotube-Release-Binaries path: ./Spotube-Release-Binaries - name: Install dependencies run: sudo apt-get install tree -y - name: Generate Checksums run: | tree . md5sum Spotube-Release-Binaries/* >> RELEASE.md5sum sha256sum Spotube-Release-Binaries/* >> RELEASE.sha256sum sed -i 's|Spotube-Release-Binaries/||' RELEASE.sha256sum RELEASE.md5sum - uses: actions/upload-artifact@v3 with: if-no-files-found: error name: Spotube-Release-Binaries path: | RELEASE.md5sum RELEASE.sha256sum - name: Upload Release Binaries (nightly) if: ${{ !inputs.dry_run && inputs.channel == 'nightly' }} uses: ncipollo/release-action@v1 with: token: ${{ secrets.GITHUB_TOKEN }} tag: nightly omitBodyDuringUpdate: true omitNameDuringUpdate: true omitPrereleaseDuringUpdate: true allowUpdates: true artifacts: Spotube-Release-Binaries/*,RELEASE.sha256sum,RELEASE.md5sum