From a7d79d12ccd7656fbda93aad7b1f841c52689c22 Mon Sep 17 00:00:00 2001 From: Kingkor Roy Tirtho Date: Sun, 12 Mar 2023 17:52:08 +0600 Subject: [PATCH 01/11] cd: fix melos version --- .github/workflows/spotube-nightly.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/spotube-nightly.yml b/.github/workflows/spotube-nightly.yml index fbb857ec..7ca519f6 100644 --- a/.github/workflows/spotube-nightly.yml +++ b/.github/workflows/spotube-nightly.yml @@ -43,7 +43,7 @@ jobs: # dart pub global activate flutter_distributor run: | git clone https://github.com/KRTirtho/flutter_distributor.git flutter_distributor - flutter pub global activate melos + flutter pub global activate melos 2.9.0 cd flutter_distributor melos bootstrap cd .. From 448c9b39f407668ad92a695afe3c9741baeca20d Mon Sep 17 00:00:00 2001 From: Kingkor Roy Tirtho Date: Sun, 12 Mar 2023 21:21:50 +0600 Subject: [PATCH 02/11] fix(android): audio notification stuck in play state --- lib/services/mobile_audio_service.dart | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/lib/services/mobile_audio_service.dart b/lib/services/mobile_audio_service.dart index 713ddb51..c21f0c0b 100644 --- a/lib/services/mobile_audio_service.dart +++ b/lib/services/mobile_audio_service.dart @@ -30,16 +30,6 @@ class MobileAudioService extends BaseAudioHandler { audioPlayer.onPositionChanged.listen((pos) async { playbackState.add(await _transformEvent()); }); - - audioPlayer.onPlayerComplete.listen((_) { - if (playlist == null) { - playbackState.add( - PlaybackState( - processingState: AudioProcessingState.completed, - ), - ); - } - }); } void addItem(MediaItem item) { From dc7584ae7f7ec5f64fffb93ce8066c2a9bc59b6c Mon Sep 17 00:00:00 2001 From: Kingkor Roy Tirtho Date: Sun, 12 Mar 2023 23:23:15 +0600 Subject: [PATCH 03/11] cd: channel based release build workflow --- .github/workflows/spotube-release-binary.yml | 330 +++++++++++++++++++ .github/workflows/spotube-release.yml | 5 - 2 files changed, 330 insertions(+), 5 deletions(-) create mode 100644 .github/workflows/spotube-release-binary.yml diff --git a/.github/workflows/spotube-release-binary.yml b/.github/workflows/spotube-release-binary.yml new file mode 100644 index 00000000..0e8f9d86 --- /dev/null +++ b/.github/workflows/spotube-release-binary.yml @@ -0,0 +1,330 @@ +name: Spotube Release Binary +on: + workflow_dispatch: + inputs: + version: + description: Version to release (x.x.x) + default: 69.420.303 + required: true + branch: + description: Branch to release + default: master + required: true + channel: + type: choice + description: Release Channel + required: true + options: + - stable + - nightly + default: nightly + dry_run: + description: Dry run + required: true + type: boolean + default: false + +jobs: + windows: + runs-on: windows-latest + steps: + - uses: actions/checkout@v3 + with: + ref: ${{ inputs.branch }} + - uses: subosito/flutter-action@v2.8.0 + with: + cache: true + + - name: Replace pubspec version (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 pubspec version (stable) + if: ${{ inputs.channel == "stable" }} + run: | + "BUILD_VERSION=${{ inputs.version }}" >> $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 Stable .env + if: ${{ inputs.channel == "stable" }} + run: echo '${{ secrets.DOTENV_RELEASE }}' > .env + + - 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 bin/create-secrets.dart '${{ secrets.LYRICS_SECRET }}' '${{ secrets.SPOTIFY_SECRET }}' + + - 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.exe dist/Spotube-windows-x86_64-setup.exe + + - name: Create Chocolatey Package and set hash + if: ${{ inputs.channel == "stable" }} + run: | + Set-Variable -Name HASH -Value (Get-FileHash dist\Spotube-windows-x86_64-setup.exe).Hash + sed -i "s/%{{WIN_SHA256}}%/$HASH/" choco-struct/tools/VERIFICATION.txt + make choco + mv dist/spotube.*.nupkg dist/Spotube-windows-x86_64.nupkg + + - name: Upload Artifact + uses: actions/upload-artifact@v3 + with: + name: Spotube-Release-Binaries + path: dist/ + + linux: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + ref: ${{ inputs.branch }} + - uses: subosito/flutter-action@v2.8.0 + with: + cache: true + + - name: Get current date + id: date + run: echo "::set-output name=date::$(date +'%Y-%m-%d')" + + - name: Install Dependencies + run: | + sudo apt-get update -y + sudo apt-get 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 libunwind-dev locate patchelf + + - name: Install AppImage Tool + run: | + wget -O appimagetool "https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-x86_64.AppImage" + chmod +x appimagetool + mv appimagetool /usr/local/bin/ + + - name: Replace pubspec version (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: Replace pubspec version (stable) + if: ${{ inputs.channel == "stable" }} + run: | + echo "BUILD_VERSION=${{ inputs.version }}" >> $GITHUB_ENV + + - name: Create Stable .env + if: ${{ inputs.channel == "stable" }} + run: echo '${{ secrets.DOTENV_RELEASE }}' > .env + + - name: Create Nightly .env + if: ${{ inputs.channel == "nightly" }} + run: echo '${{ secrets.DOTENV_NIGHTLY }}' > .env + + - name: Replace Version in files + run: | + sed -i 's|%{{APPDATA_RELEASE}}%||' linux/com.github.KRTirtho.Spotube.appdata.xml + + - name: Generate Secrets + run: | + flutter config --enable-linux-desktop + flutter pub get + dart bin/create-secrets.dart '${{ secrets.LYRICS_SECRET }}' '${{ secrets.SPOTIFY_SECRET }}' + + - name: Build Linux Packages + run: | + dart pub global activate flutter_distributor + flutter_distributor package --platform=linux --targets=deb,appimage,rpm --skip-clean + make tar + + - name: Move Files to dist + run: | + mv build/Spotube-linux-x86_64.tar.xz dist/ + mv dist/**/spotube-*-linux.deb dist/Spotube-linux-x86_64.deb + mv dist/**/spotube-*-linux.rpm dist/Spotube-linux-x86_64.rpm + mv dist/**/spotube-*-linux.AppImage dist/Spotube-linux-x86_64.AppImage + + - uses: actions/upload-artifact@v3 + with: + name: Spotube-Release-Binaries + path: dist/ + + android: + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v3 + with: + ref: ${{ inputs.branch }} + - uses: subosito/flutter-action@v2.8.0 + with: + cache: true + + - 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 + + - name: Replace pubspec version (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: Replace pubspec version (stable) + if: ${{ inputs.channel == "stable" }} + run: | + echo "BUILD_VERSION=${{ inputs.version }}" >> $GITHUB_ENV + + - name: Create Stable .env + if: ${{ inputs.channel == "stable" }} + run: echo '${{ secrets.DOTENV_RELEASE }}' > .env + + - name: Create Nightly .env + if: ${{ inputs.channel == "nightly" }} + run: echo '${{ secrets.DOTENV_NIGHTLY }}' > .env + + - name: Generate Secrets and Build apk + run: | + flutter pub get + dart bin/create-secrets.dart '${{ secrets.LYRICS_SECRET }}' '${{ secrets.SPOTIFY_SECRET }}' + + - name: Sign Apk + run: | + echo '${{ secrets.KEYSTORE }}' | base64 --decode > android/app/upload-keystore.jks + echo '${{ secrets.KEY_PROPERTIES }}' > android/key.properties + + - name: Build Apk + run: | + flutter build apk + mv build/app/outputs/apk/release/app-release.apk build/Spotube-android-all-arch.apk + + - uses: actions/upload-artifact@v3 + with: + name: Spotube-Release-Binaries + path: | + build/Spotube-android-all-arch.apk + + macos: + runs-on: macos-12 + steps: + - uses: actions/checkout@v3 + with: + ref: ${{ inputs.branch }} + - uses: subosito/flutter-action@v2.8.0 + with: + cache: true + + - name: Replace pubspec version (nightly) + if: ${{ inputs.channel == "nightly" }} + run: | + brew install yq + 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: Replace pubspec version (stable) + if: ${{ inputs.channel == "stable" }} + run: | + echo "BUILD_VERSION=${{ inputs.version }}" >> $GITHUB_ENV + + - name: Create Stable .env + if: ${{ inputs.channel == "stable" }} + run: echo '${{ secrets.DOTENV_RELEASE }}' > .env + + - name: Create Nightly .env + if: ${{ inputs.channel == "nightly" }} + run: echo '${{ secrets.DOTENV_NIGHTLY }}' > .env + + - name: Generate Secrets + run: | + flutter pub get + dart bin/create-secrets.dart '${{ secrets.LYRICS_SECRET }}' '${{ secrets.SPOTIFY_SECRET }}' + + - name: Build Macos App + run: | + flutter config --enable-macos-desktop + flutter build macos + du -sh build/macos/Build/Products/Release/spotube.app + + - name: Package Macos App + run: | + npm install -g appdmg + mkdir -p build/${{ env.BUILD_VERSION }} + appdmg appdmg.json build/Spotube-macos-x86_64.dmg + + - uses: actions/upload-artifact@v3 + with: + name: Spotube-Release-Binaries + path: | + build/Spotube-macos-x86_64.dmg + + upload: + runs-on: ubuntu-22.04 + needs: + - windows + - linux + - android + - macos + steps: + - uses: actions/download-artifact@v3 + with: + name: Spotube-Release-Bundle + path: ./Spotube-Release-Bundle + + - name: Install dependencies + run: sudo apt-get install tree -y + + - name: Generate Checksums + run: | + tree . + md5sum ./Spotube-Release-Bundle/* >> RELEASE.md5sum + sha256sum ./Spotube-Macos-Bundle/* >> RELEASE.sha256sum + sed -i 's|Spotube-Release-Bundle/||' RELEASE.sha256sum RELEASE.md5sum + + - uses: actions/upload-artifact@v3 + with: + name: Spotube-Release-Bundle + path: | + RELEASE.md5sum + RELEASE.sha256sum + + - name: Upload Release Binaries (stable) + if: ${{ !inputs.dry_run && inputs.channel == "stable" }} + uses: ncipollo/release-action@v1 + with: + token: ${{ secrets.GITHUB_TOKEN }} + tag: v${{ inputs.version }} + omitBodyDuringUpdate: true + omitNameDuringUpdate: true + omitPrereleaseDuringUpdate: true + allowUpdates: true + artifacts: Spotube-Release-Bundle/*,RELEASE.sha256sum,RELEASE.md5sum + + - 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-Bundle/*,RELEASE.sha256sum,RELEASE.md5sum diff --git a/.github/workflows/spotube-release.yml b/.github/workflows/spotube-release.yml index 04542b7f..a5545dd8 100644 --- a/.github/workflows/spotube-release.yml +++ b/.github/workflows/spotube-release.yml @@ -17,11 +17,6 @@ jobs: runs-on: windows-latest steps: - uses: actions/checkout@v3 - - uses: actions/checkout@v3 - with: - repository: KRTirtho/flutter_distributor - ref: deb-implementation - path: build/flutter_distributor - name: Replace version in files run: | From 88f27ad5205c7333ae6841a6a6526983245c64b4 Mon Sep 17 00:00:00 2001 From: Kingkor Roy Tirtho Date: Sun, 12 Mar 2023 23:25:29 +0600 Subject: [PATCH 04/11] cd: remove branch input --- .github/workflows/spotube-release-binary.yml | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/.github/workflows/spotube-release-binary.yml b/.github/workflows/spotube-release-binary.yml index 0e8f9d86..8f4c160b 100644 --- a/.github/workflows/spotube-release-binary.yml +++ b/.github/workflows/spotube-release-binary.yml @@ -6,10 +6,6 @@ on: description: Version to release (x.x.x) default: 69.420.303 required: true - branch: - description: Branch to release - default: master - required: true channel: type: choice description: Release Channel @@ -29,8 +25,6 @@ jobs: runs-on: windows-latest steps: - uses: actions/checkout@v3 - with: - ref: ${{ inputs.branch }} - uses: subosito/flutter-action@v2.8.0 with: cache: true @@ -94,8 +88,6 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - with: - ref: ${{ inputs.branch }} - uses: subosito/flutter-action@v2.8.0 with: cache: true @@ -168,8 +160,6 @@ jobs: runs-on: ubuntu-22.04 steps: - uses: actions/checkout@v3 - with: - ref: ${{ inputs.branch }} - uses: subosito/flutter-action@v2.8.0 with: cache: true @@ -225,8 +215,6 @@ jobs: runs-on: macos-12 steps: - uses: actions/checkout@v3 - with: - ref: ${{ inputs.branch }} - uses: subosito/flutter-action@v2.8.0 with: cache: true From 01868a41ca54347f382c5bc9d81676522a6779bc Mon Sep 17 00:00:00 2001 From: Kingkor Roy Tirtho Date: Sun, 12 Mar 2023 23:28:36 +0600 Subject: [PATCH 05/11] cd: fix double quotes syntax error --- .github/workflows/spotube-release-binary.yml | 38 ++++++++++---------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/.github/workflows/spotube-release-binary.yml b/.github/workflows/spotube-release-binary.yml index 8f4c160b..8805a32c 100644 --- a/.github/workflows/spotube-release-binary.yml +++ b/.github/workflows/spotube-release-binary.yml @@ -30,7 +30,7 @@ jobs: cache: true - name: Replace pubspec version (nightly) - if: ${{ inputs.channel == "nightly" }} + if: ${{ inputs.channel == 'nightly' }} run: | choco install sed make yq -y yq -i '.version |= sub("\+\d+", "+${{ inputs.channel }}.")' pubspec.yaml @@ -38,7 +38,7 @@ jobs: "BUILD_VERSION=${{ inputs.version }}+${{ inputs.channel }}.${{ github.run_number }}" >> $env:GITHUB_ENV - name: Replace pubspec version (stable) - if: ${{ inputs.channel == "stable" }} + if: ${{ inputs.channel == 'stable' }} run: | "BUILD_VERSION=${{ inputs.version }}" >> $env:GITHUB_ENV @@ -50,11 +50,11 @@ jobs: sed -i "s/%{{SPOTUBE_VERSION}}%/${{ env.BUILD_VERSION }}/" choco-struct/spotube.nuspec - name: Create Stable .env - if: ${{ inputs.channel == "stable" }} + if: ${{ inputs.channel == 'stable' }} run: echo '${{ secrets.DOTENV_RELEASE }}' > .env - name: Create Nightly .env - if: ${{ inputs.channel == "nightly" }} + if: ${{ inputs.channel == 'nightly' }} run: echo '${{ secrets.DOTENV_NIGHTLY }}' > .env - name: Generating Secrets @@ -71,7 +71,7 @@ jobs: mv dist/**/spotube-*-windows.exe dist/Spotube-windows-x86_64-setup.exe - name: Create Chocolatey Package and set hash - if: ${{ inputs.channel == "stable" }} + if: ${{ inputs.channel == 'stable' }} run: | Set-Variable -Name HASH -Value (Get-FileHash dist\Spotube-windows-x86_64-setup.exe).Hash sed -i "s/%{{WIN_SHA256}}%/$HASH/" choco-struct/tools/VERIFICATION.txt @@ -108,7 +108,7 @@ jobs: mv appimagetool /usr/local/bin/ - name: Replace pubspec version (nightly) - if: ${{ inputs.channel == "nightly" }} + if: ${{ inputs.channel == 'nightly' }} run: | curl -sS https://webi.sh/yq | sh yq -i '.version |= sub("\+\d+", "+${{ inputs.channel }}.")' pubspec.yaml @@ -116,16 +116,16 @@ jobs: echo "BUILD_VERSION=${{ inputs.version }}+${{ inputs.channel }}.${{ github.run_number }}" >> $GITHUB_ENV - name: Replace pubspec version (stable) - if: ${{ inputs.channel == "stable" }} + if: ${{ inputs.channel == 'stable' }} run: | echo "BUILD_VERSION=${{ inputs.version }}" >> $GITHUB_ENV - name: Create Stable .env - if: ${{ inputs.channel == "stable" }} + if: ${{ inputs.channel == 'stable' }} run: echo '${{ secrets.DOTENV_RELEASE }}' > .env - name: Create Nightly .env - if: ${{ inputs.channel == "nightly" }} + if: ${{ inputs.channel == 'nightly' }} run: echo '${{ secrets.DOTENV_NIGHTLY }}' > .env - name: Replace Version in files @@ -170,7 +170,7 @@ jobs: 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 - name: Replace pubspec version (nightly) - if: ${{ inputs.channel == "nightly" }} + if: ${{ inputs.channel == 'nightly' }} run: | curl -sS https://webi.sh/yq | sh yq -i '.version |= sub("\+\d+", "+${{ inputs.channel }}.")' pubspec.yaml @@ -178,16 +178,16 @@ jobs: echo "BUILD_VERSION=${{ inputs.version }}+${{ inputs.channel }}.${{ github.run_number }}" >> $GITHUB_ENV - name: Replace pubspec version (stable) - if: ${{ inputs.channel == "stable" }} + if: ${{ inputs.channel == 'stable' }} run: | echo "BUILD_VERSION=${{ inputs.version }}" >> $GITHUB_ENV - name: Create Stable .env - if: ${{ inputs.channel == "stable" }} + if: ${{ inputs.channel == 'stable' }} run: echo '${{ secrets.DOTENV_RELEASE }}' > .env - name: Create Nightly .env - if: ${{ inputs.channel == "nightly" }} + if: ${{ inputs.channel == 'nightly' }} run: echo '${{ secrets.DOTENV_NIGHTLY }}' > .env - name: Generate Secrets and Build apk @@ -220,7 +220,7 @@ jobs: cache: true - name: Replace pubspec version (nightly) - if: ${{ inputs.channel == "nightly" }} + if: ${{ inputs.channel == 'nightly' }} run: | brew install yq yq -i '.version |= sub("\+\d+", "+${{ inputs.channel }}.")' pubspec.yaml @@ -228,16 +228,16 @@ jobs: echo "BUILD_VERSION=${{ inputs.version }}+${{ inputs.channel }}.${{ github.run_number }}" >> $GITHUB_ENV - name: Replace pubspec version (stable) - if: ${{ inputs.channel == "stable" }} + if: ${{ inputs.channel == 'stable' }} run: | echo "BUILD_VERSION=${{ inputs.version }}" >> $GITHUB_ENV - name: Create Stable .env - if: ${{ inputs.channel == "stable" }} + if: ${{ inputs.channel == 'stable' }} run: echo '${{ secrets.DOTENV_RELEASE }}' > .env - name: Create Nightly .env - if: ${{ inputs.channel == "nightly" }} + if: ${{ inputs.channel == 'nightly' }} run: echo '${{ secrets.DOTENV_NIGHTLY }}' > .env - name: Generate Secrets @@ -294,7 +294,7 @@ jobs: RELEASE.sha256sum - name: Upload Release Binaries (stable) - if: ${{ !inputs.dry_run && inputs.channel == "stable" }} + if: ${{ !inputs.dry_run && inputs.channel == 'stable' }} uses: ncipollo/release-action@v1 with: token: ${{ secrets.GITHUB_TOKEN }} @@ -306,7 +306,7 @@ jobs: artifacts: Spotube-Release-Bundle/*,RELEASE.sha256sum,RELEASE.md5sum - name: Upload Release Binaries (nightly) - if: ${{ !inputs.dry_run && inputs.channel == "nightly" }} + if: ${{ !inputs.dry_run && inputs.channel == 'nightly' }} uses: ncipollo/release-action@v1 with: token: ${{ secrets.GITHUB_TOKEN }} From 7fed80a3040052fde4acb0b5529b77f077075366 Mon Sep 17 00:00:00 2001 From: Kingkor Roy Tirtho Date: Mon, 13 Mar 2023 00:39:32 +0600 Subject: [PATCH 06/11] cd: fix artifact name --- .github/workflows/spotube-release-binary.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/spotube-release-binary.yml b/.github/workflows/spotube-release-binary.yml index 8805a32c..6815e66f 100644 --- a/.github/workflows/spotube-release-binary.yml +++ b/.github/workflows/spotube-release-binary.yml @@ -273,8 +273,8 @@ jobs: steps: - uses: actions/download-artifact@v3 with: - name: Spotube-Release-Bundle - path: ./Spotube-Release-Bundle + name: Spotube-Release-Binaries + path: ./Spotube-Release-Binaries - name: Install dependencies run: sudo apt-get install tree -y @@ -282,13 +282,13 @@ jobs: - name: Generate Checksums run: | tree . - md5sum ./Spotube-Release-Bundle/* >> RELEASE.md5sum + md5sum ./Spotube-Release-Binaries/* >> RELEASE.md5sum sha256sum ./Spotube-Macos-Bundle/* >> RELEASE.sha256sum - sed -i 's|Spotube-Release-Bundle/||' RELEASE.sha256sum RELEASE.md5sum + sed -i 's|Spotube-Release-Binaries/||' RELEASE.sha256sum RELEASE.md5sum - uses: actions/upload-artifact@v3 with: - name: Spotube-Release-Bundle + name: Spotube-Release-Binaries path: | RELEASE.md5sum RELEASE.sha256sum @@ -303,7 +303,7 @@ jobs: omitNameDuringUpdate: true omitPrereleaseDuringUpdate: true allowUpdates: true - artifacts: Spotube-Release-Bundle/*,RELEASE.sha256sum,RELEASE.md5sum + artifacts: Spotube-Release-Binaries/*,RELEASE.sha256sum,RELEASE.md5sum - name: Upload Release Binaries (nightly) if: ${{ !inputs.dry_run && inputs.channel == 'nightly' }} @@ -315,4 +315,4 @@ jobs: omitNameDuringUpdate: true omitPrereleaseDuringUpdate: true allowUpdates: true - artifacts: Spotube-Release-Bundle/*,RELEASE.sha256sum,RELEASE.md5sum + artifacts: Spotube-Release-Binaries/*,RELEASE.sha256sum,RELEASE.md5sum From 4204789d4b7e81ea92cb5cbe0ca61e17f0bea74e Mon Sep 17 00:00:00 2001 From: Kingkor Roy Tirtho Date: Wed, 15 Mar 2023 09:17:26 +0600 Subject: [PATCH 07/11] cd: fix sha256 sum bundle path --- .github/workflows/spotube-release-binary.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/spotube-release-binary.yml b/.github/workflows/spotube-release-binary.yml index 6815e66f..70702d54 100644 --- a/.github/workflows/spotube-release-binary.yml +++ b/.github/workflows/spotube-release-binary.yml @@ -4,7 +4,7 @@ on: inputs: version: description: Version to release (x.x.x) - default: 69.420.303 + default: 2.7.0 required: true channel: type: choice @@ -283,7 +283,7 @@ jobs: run: | tree . md5sum ./Spotube-Release-Binaries/* >> RELEASE.md5sum - sha256sum ./Spotube-Macos-Bundle/* >> RELEASE.sha256sum + sha256sum ./Spotube-Release-Binaries/* >> RELEASE.sha256sum sed -i 's|Spotube-Release-Binaries/||' RELEASE.sha256sum RELEASE.md5sum - uses: actions/upload-artifact@v3 From 0cb87ba6df30b988608e24b2f857a3694f1378d1 Mon Sep 17 00:00:00 2001 From: Kingkor Roy Tirtho Date: Wed, 15 Mar 2023 10:05:59 +0600 Subject: [PATCH 08/11] cd: create a separate publish workflow --- .github/workflows/spotube-nightly.yml | 204 ------------- .github/workflows/spotube-publish-binary.yml | 98 ++++++ .github/workflows/spotube-release-binary.yml | 4 +- .github/workflows/spotube-release.yml | 306 ------------------- .vscode/settings.json | 3 +- 5 files changed, 102 insertions(+), 513 deletions(-) delete mode 100644 .github/workflows/spotube-nightly.yml create mode 100644 .github/workflows/spotube-publish-binary.yml delete mode 100644 .github/workflows/spotube-release.yml diff --git a/.github/workflows/spotube-nightly.yml b/.github/workflows/spotube-nightly.yml deleted file mode 100644 index 7ca519f6..00000000 --- a/.github/workflows/spotube-nightly.yml +++ /dev/null @@ -1,204 +0,0 @@ -name: Spotube Nightly -on: - push: - branches: - - build - workflow_dispatch: - -jobs: - build_ubuntu: - runs-on: ubuntu-22.04 - steps: - - uses: actions/checkout@v3 - - uses: subosito/flutter-action@v2.8.0 - with: - cache: true - - - name: Getting current date - id: date - run: echo "::set-output name=date::$(date +'%Y-%m-%d')" - - - name: Installing dependencies and configuring version - run: | - sudo apt-get update -y - sudo apt-get install -y tar clang cmake ninja-build pkg-config libgtk-3-dev make python3-pip python3-setuptools desktop-file-utils libgdk-pixbuf2.0-dev fakeroot strace fuse libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev locate patchelf libunwind-dev - curl -sS https://webi.sh/yq | sh - yq -i '.version |= sub("\+\d+", "+nightly.")' pubspec.yaml - yq -i '.version += strenv(GITHUB_RUN_NUMBER)' pubspec.yaml - flutter config --enable-linux-desktop - flutter pub get - - - name: Installing appimagetool - run: | - wget -O appimagetool "https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-x86_64.AppImage" - chmod +x appimagetool - mv appimagetool /usr/local/bin/ - - - name: Generating Secrets - run: | - echo '${{ secrets.DOTENV_NIGHTLY }}' > .env - dart bin/create-secrets.dart '${{ secrets.LYRICS_SECRET }}' '${{ secrets.SPOTIFY_SECRET }}' - - - name: Building Linux application - # dart pub global activate flutter_distributor - run: | - git clone https://github.com/KRTirtho/flutter_distributor.git flutter_distributor - flutter pub global activate melos 2.9.0 - cd flutter_distributor - melos bootstrap - cd .. - dart flutter_distributor/packages/flutter_distributor/bin/main.dart package --platform=linux --targets=deb,appimage,rpm --skip-clean - make tar - mv build/Spotube-linux-x86_64.tar.xz dist/Spotube-linux-x86_64-nightly.tar.xz - mv dist/**/spotube-*-linux.deb dist/Spotube-linux-x86_64-nightly.deb - mv dist/**/spotube-*-linux.rpm dist/Spotube-linux-x86_64-nightly.rpm - mv dist/**/spotube-*-linux.AppImage dist/Spotube-linux-x86_64-nightly.AppImage - - - name: Uploading binaries to release - uses: svenstaro/upload-release-action@v2 - with: - repo_token: ${{ secrets.GITHUB_TOKEN }} - file_glob: true - file: dist/* - tag: refs/tags/nightly - body: | - ## nightly-${{ github.run_number }} - Nightly build no. ${{ github.run_number }} of Spotube - overwrite: true - - - name: Setting up upterm session - if: ${{ failure() }} - uses: lhotari/action-upterm@v1 - with: - limit-access-to-actor: true - - build_android: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - uses: subosito/flutter-action@v2.8.0 - with: - cache: true - - - name: Installing dependencies and configuring version - 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 desktop-file-utils libgdk-pixbuf2.0-dev fakeroot strace fuse - curl -sS https://webi.sh/yq | sh - yq -i '.version |= sub("\+\d+", "+nightly.")' pubspec.yaml - yq -i '.version += strenv(GITHUB_RUN_NUMBER)' pubspec.yaml - flutter pub get - - - name: Generating Secrets and key store - run: | - echo '${{ secrets.DOTENV_NIGHTLY }}' > .env - dart bin/create-secrets.dart '${{ secrets.LYRICS_SECRET }}' '${{ secrets.SPOTIFY_SECRET }}' - echo '${{ secrets.KEYSTORE }}' | base64 --decode > android/app/upload-keystore.jks - echo '${{ secrets.KEY_PROPERTIES }}' > android/key.properties - - - name: Building Android apk - run: | - flutter build apk - mv build/app/outputs/apk/release/app-release.apk build/Spotube-android-all-arch-nightly.apk - - - name: Uploading binaries to release - uses: svenstaro/upload-release-action@v2 - with: - repo_token: ${{ secrets.GITHUB_TOKEN }} - file: build/Spotube-android-all-arch-nightly.apk - tag: refs/tags/nightly - body: | - ## nightly-${{ github.run_number }} - Nightly build no. ${{ github.run_number }} of Spotube - overwrite: true - - - name: Setting up upterm session - if: ${{ failure() }} - uses: lhotari/action-upterm@v1 - with: - limit-access-to-actor: true - - build_windows: - runs-on: windows-latest - steps: - - uses: actions/checkout@v3 - - uses: subosito/flutter-action@v2.8.0 - with: - cache: true - - - name: Installing dependencies and configuring versions - run: | - choco install sed make yq -y - yq -i '.version |= sub("\+\d+", "+nightly.")' pubspec.yaml - yq -i '.version += strenv(GITHUB_RUN_NUMBER)' pubspec.yaml - sed -i "s/%{{SPOTUBE_VERSION}}%/${{ github.run_number }}/" windows/runner/Runner.rc - flutter config --enable-windows-desktop - flutter pub get - - - name: Generating Secrets - run: | - echo '${{ secrets.DOTENV_NIGHTLY }}' > .env - dart bin/create-secrets.dart '${{ secrets.LYRICS_SECRET }}' '${{ secrets.SPOTIFY_SECRET }}' - - - name: Building for Windows x64 - 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-nightly.exe - - - name: Uploading binaries to release - uses: svenstaro/upload-release-action@v2 - with: - repo_token: ${{ secrets.GITHUB_TOKEN }} - file_glob: true - file: dist/* - tag: refs/tags/nightly - body: | - ## nightly-${{ github.run_number }} - Nightly build no. ${{ github.run_number }} of Spotube - overwrite: true - - build_macos: - runs-on: macos-11 - steps: - - uses: actions/checkout@v3 - - uses: subosito/flutter-action@v2.8.0 - with: - cache: true - - - name: Installing dependencies and configuring versions - run: | - brew install yq - yq -i '.version |= sub("\+\d+", "+nightly.")' pubspec.yaml - yq -i '.version += strenv(GITHUB_RUN_NUMBER)' pubspec.yaml - flutter config --enable-macos-desktop - flutter pub get - - - name: Generating Secrets - run: | - echo '${{ secrets.DOTENV_NIGHTLY }}' > .env - dart bin/create-secrets.dart '${{ secrets.LYRICS_SECRET }}' '${{ secrets.SPOTIFY_SECRET }}' - - - name: Building for MacOS - run: | - flutter build macos - npm install -g appdmg - appdmg appdmg.json build/Spotube-macos-x86_64-nightly.dmg - - - name: Uploading binaries to release - uses: svenstaro/upload-release-action@v2 - with: - repo_token: ${{ secrets.GITHUB_TOKEN }} - file: build/Spotube-macos-x86_64-nightly.dmg - tag: refs/tags/nightly - body: | - ## nightly-${{ github.run_number }} - Nightly build no. ${{ github.run_number }} of Spotube - overwrite: true - - - name: Setting up upterm session - if: ${{ failure() }} - uses: lhotari/action-upterm@v1 - with: - limit-access-to-actor: true diff --git a/.github/workflows/spotube-publish-binary.yml b/.github/workflows/spotube-publish-binary.yml new file mode 100644 index 00000000..1d297b1a --- /dev/null +++ b/.github/workflows/spotube-publish-binary.yml @@ -0,0 +1,98 @@ +name: Spotube Publish Binary +on: + workflow_dispatch: + inputs: + version: + description: Version to release (x.x.x) + default: 2.7.0 + required: true + dry_run: + description: Dry run + required: true + type: boolean + default: false + +jobs: + flathub: + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v3 + with: + repository: flathub/com.github.KRTirtho.Spotube + token: ${{ secrets.FLATHUB_TOKEN }} + - uses: actions/checkout@v3 + with: + path: spotube + + - name: Update flathub version + run: | + python3 spotube/scripts/update_flathub_version.py ${{ inputs.version }} + rm -rf spotube + git config --global user.email "krtirtho@gmail.com" + git config --global user.name "Kingkor Roy Tirtho" + git add . + git commit -m "v${{ inputs.version }} Update" + git branch update-${{ inputs.version }} + git switch update-${{ inputs.version }} + + - name: Push to flathub + if: ${{ !inputs.dry_run }} + run: git push -u origin update-${{ inputs.version }} + + aur: + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v3 + + - uses: dsaltares/fetch-gh-release-asset@master + with: + version: tags/v${{ inputs.version }} # mind the "v" prefix + file: Spotube-linux-x86_64.tar.xz + token: ${{ secrets.GITHUB_TOKEN }} + + - name: Update PKGBUILD versions + run: | + sed -i "s/%{{SPOTUBE_VERSION}}%/${{ inputs.version }}/" aur-struct/PKGBUILD + sed -i "s/%{{PKGREL}}%/1/" aur-struct/PKGBUILD + sed -i "s/%{{LINUX_MD5}}%/`md5sum Spotube-linux-x86_64.tar.xz | awk '{print $1}'`/" aur-struct/PKGBUILD + + - name: Release to AUR + if: ${{ !inputs.dry_run }} + uses: KSXGitHub/github-actions-deploy-aur@v2.6.0 + with: + pkgname: spotube-bin + pkgbuild: aur-struct/PKGBUILD + commit_username: ${{ secrets.AUR_USERNAME }} + commit_email: ${{ secrets.AUR_EMAIL }} + ssh_private_key: ${{ secrets.AUR_SSH_PRIVATE_KEY }} + commit_message: Updated to v${{ inputs.version }} + + winget: + runs-on: windows-latest + steps: + - name: Release winget package + if: ${{ !inputs.dry_run }} + uses: vedantmgoyal2009/winget-releaser@v2 + with: + version: ${{ inputs.version }} + release-tag: v${{ inputs.version }} + identifier: KRTirtho.Spotube + token: ${{ secrets.WINGET_TOKEN }} + + chocolatey: + runs-on: windows-latest + steps: + - uses: dsaltares/fetch-gh-release-asset@master + with: + version: tags/v${{ inputs.version }} # mind the "v" prefix + file: Spotube-windows-x86_64.nupkg + token: ${{ secrets.GITHUB_TOKEN }} + + - name: Set up Chocolatey + run: | + choco apikey -k ${{ secrets.CHOCO_API_KEY }} -s https://push.chocolatey.org/ + + - name: Publish to Chocolatey Repository + if: ${{ !inputs.dry_run }} + run: | + choco push Spotube-windows-x86_64.nupkg diff --git a/.github/workflows/spotube-release-binary.yml b/.github/workflows/spotube-release-binary.yml index 70702d54..ec1ef70b 100644 --- a/.github/workflows/spotube-release-binary.yml +++ b/.github/workflows/spotube-release-binary.yml @@ -284,7 +284,7 @@ jobs: tree . md5sum ./Spotube-Release-Binaries/* >> RELEASE.md5sum sha256sum ./Spotube-Release-Binaries/* >> RELEASE.sha256sum - sed -i 's|Spotube-Release-Binaries/||' RELEASE.sha256sum RELEASE.md5sum + sed -i 's|./Spotube-Release-Binaries/||' RELEASE.sha256sum RELEASE.md5sum - uses: actions/upload-artifact@v3 with: @@ -298,7 +298,7 @@ jobs: uses: ncipollo/release-action@v1 with: token: ${{ secrets.GITHUB_TOKEN }} - tag: v${{ inputs.version }} + tag: v${{ inputs.version }} # mind the "v" prefix omitBodyDuringUpdate: true omitNameDuringUpdate: true omitPrereleaseDuringUpdate: true diff --git a/.github/workflows/spotube-release.yml b/.github/workflows/spotube-release.yml deleted file mode 100644 index a5545dd8..00000000 --- a/.github/workflows/spotube-release.yml +++ /dev/null @@ -1,306 +0,0 @@ -name: Spotube Release -on: - workflow_dispatch: - inputs: - version: - description: "Version to release (x.x.x)" - required: true - default: "69.420.303" - dry_run: - description: "Dry run" - required: true - type: boolean - default: false - -jobs: - publish_chocolatey: - runs-on: windows-latest - steps: - - uses: actions/checkout@v3 - - - name: Replace version in files - run: | - choco install sed make -y - sed -i "s/%{{SPOTUBE_VERSION}}%/${{ inputs.version }}/" windows/runner/Runner.rc - sed -i "s/%{{SPOTUBE_VERSION}}%/${{ inputs.version }}/" choco-struct/tools/VERIFICATION.txt - sed -i "s/%{{SPOTUBE_VERSION}}%/${{ inputs.version }}/" choco-struct/spotube.nuspec - - - uses: subosito/flutter-action@v2.8.0 - with: - cache: true - - - name: Generating Secrets - run: | - echo '${{ secrets.DOTENV_RELEASE }}' > .env - flutter config --enable-windows-desktop - flutter pub get - dart bin/create-secrets.dart '${{ secrets.LYRICS_SECRET }}' '${{ secrets.SPOTIFY_SECRET }}' - - - name: Build Windows Executable - run: | - dart pub global activate flutter_distributor - make innoinstall - flutter_distributor package --platform=windows --targets=exe --skip-clean - - - name: Create Chocolatey Package and set hash - run: | - mv dist/**/spotube-*-windows.exe dist/Spotube-windows-x86_64-setup.exe - Set-Variable -Name HASH -Value (Get-FileHash dist\Spotube-windows-x86_64-setup.exe).Hash - sed -i "s/%{{WIN_SHA256}}%/$HASH/" choco-struct/tools/VERIFICATION.txt - make choco - - - run: mv dist/spotube.*.nupkg dist/Spotube-windows-x86_64.nupkg - - - name: Publish to Chocolatey Repository - if: ${{ !inputs.dry_run }} - run: | - choco apikey -k ${{ secrets.CHOCO_API_KEY }} -s https://push.chocolatey.org/ - choco push dist/Spotube-windows-x86_64.nupkg - echo 'published to community.chocolatey.org' - - - name: Upload Artifact - uses: actions/upload-artifact@v3 - with: - name: Spotube-Windows-Bundle - path: dist/ - - - name: Connect via SSH on failure - if: ${{ failure() }} - uses: mxschmitt/action-tmate@v3 - with: - limit-access-to-actor: true - timeout-minutes: 15 - - publish_macos: - runs-on: macos-11 - steps: - - uses: actions/checkout@v3 - - uses: subosito/flutter-action@v2.8.0 - with: - cache: true - - run: echo '${{ secrets.DOTENV_RELEASE }}' > .env - - run: flutter config --enable-macos-desktop - - run: flutter pub get - - run: dart bin/create-secrets.dart '${{ secrets.LYRICS_SECRET }}' '${{ secrets.SPOTIFY_SECRET }}' - - run: flutter build macos - - run: du -sh build/macos/Build/Products/Release/spotube.app - - run: npm install -g appdmg - - run: mkdir -p build/${{ inputs.version }} - - run: appdmg appdmg.json build/${{ inputs.version }}/Spotube-macos-x86_64.dmg - - uses: actions/upload-artifact@v3 - with: - name: Spotube-Macos-Bundle - path: | - build/${{ inputs.version }}/Spotube-macos-x86_64.dmg - - publish_linux: - runs-on: ubuntu-22.04 - steps: - - uses: actions/checkout@v3 - - uses: subosito/flutter-action@v2.8.0 - with: - cache: true - - - name: Get current date - id: date - run: echo "::set-output name=date::$(date +'%Y-%m-%d')" - - - name: Install Dependencies - run: | - sudo apt-get update -y - sudo apt-get 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 libunwind-dev locate patchelf - - - name: Install AppImage Tool - run: | - wget -O appimagetool "https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-x86_64.AppImage" - chmod +x appimagetool - mv appimagetool /usr/local/bin/ - - - name: Replace Version in files - run: | - sed -i 's|%{{APPDATA_RELEASE}}%||' linux/com.github.KRTirtho.Spotube.appdata.xml - echo '${{ secrets.DOTENV_RELEASE }}' > .env - - - name: Generate Secrets - run: | - flutter config --enable-linux-desktop - flutter pub get - dart bin/create-secrets.dart '${{ secrets.LYRICS_SECRET }}' '${{ secrets.SPOTIFY_SECRET }}' - - - name: Build Linux Packages - run: | - dart pub global activate flutter_distributor - flutter_distributor package --platform=linux --targets=deb,appimage,rpm --skip-clean - make tar - - - name: Move Files to dist - run: | - mv build/Spotube-linux-x86_64.tar.xz dist/ - mv dist/**/spotube-*-linux.deb dist/Spotube-linux-x86_64.deb - mv dist/**/spotube-*-linux.rpm dist/Spotube-linux-x86_64.rpm - mv dist/**/spotube-*-linux.AppImage dist/Spotube-linux-x86_64.AppImage - - - uses: actions/upload-artifact@v3 - with: - name: Spotube-Linux-Bundle - path: dist/ - - publish_android: - runs-on: ubuntu-22.04 - steps: - - uses: actions/checkout@v3 - - uses: subosito/flutter-action@v2.8.0 - with: - cache: true - - - 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 - - - name: Generate Secrets and Build apk - run: | - echo '${{ secrets.DOTENV_RELEASE }}' > .env - flutter pub get - dart bin/create-secrets.dart '${{ secrets.LYRICS_SECRET }}' '${{ secrets.SPOTIFY_SECRET }}' - echo '${{ secrets.KEYSTORE }}' | base64 --decode > android/app/upload-keystore.jks - echo '${{ secrets.KEY_PROPERTIES }}' > android/key.properties - flutter build apk - make apk - - - uses: actions/upload-artifact@v3 - with: - name: Spotube-Android-Bundle - path: | - build/Spotube-android-all-arch.apk - - update_release: - needs: - - publish_chocolatey - - publish_macos - - publish_linux - - publish_android - runs-on: ubuntu-22.04 - permissions: - contents: write - steps: - - uses: actions/download-artifact@v3 - with: - name: Spotube-Windows-Bundle - path: ./Spotube-Windows-Bundle - - uses: actions/download-artifact@v3 - with: - name: Spotube-Macos-Bundle - path: ./Spotube-Macos-Bundle - - uses: actions/download-artifact@v3 - with: - name: Spotube-Linux-Bundle - path: ./Spotube-Linux-Bundle - - uses: actions/download-artifact@v3 - with: - name: Spotube-Android-Bundle - path: ./Spotube-Android-Bundle - - - name: Install dependencies - run: sudo apt-get install tree -y - - - name: Generate Checksums - run: | - tree . - md5sum ./Spotube-Windows-Bundle/*.{exe,nupkg} >> RELEASE.md5sum - md5sum ./Spotube-Macos-Bundle/*.dmg >> RELEASE.md5sum - md5sum ./Spotube-Linux-Bundle/*.{AppImage,tar.xz,deb,rpm} >> RELEASE.md5sum - md5sum ./Spotube-Android-Bundle/*.apk >> RELEASE.md5sum - sha256sum ./Spotube-Macos-Bundle/*.dmg >> RELEASE.sha256sum - sha256sum ./Spotube-Windows-Bundle/*.{exe,nupkg} >> RELEASE.sha256sum - sha256sum ./Spotube-Linux-Bundle/*.{AppImage,tar.xz,deb,rpm} >> RELEASE.sha256sum - sha256sum ./Spotube-Android-Bundle/*.apk >> RELEASE.sha256sum - sed -i 's|Spotube-.*-Bundle/||' RELEASE.sha256sum RELEASE.md5sum - - - uses: actions/upload-artifact@v3 - with: - name: Spotube-Sums-Bundle - path: | - RELEASE.md5sum - RELEASE.sha256sum - - - name: Upload Release Binaries - if: ${{ !inputs.dry_run }} - uses: ncipollo/release-action@v1 - with: - token: ${{ secrets.GITHUB_TOKEN }} - tag: v${{ inputs.version }} - omitBodyDuringUpdate: true - omitNameDuringUpdate: true - omitPrereleaseDuringUpdate: true - allowUpdates: true - artifacts: Spotube-Windows-Bundle/*,Spotube-Macos-Bundle/*,Spotube-Linux-Bundle/*,Spotube-Android-Bundle/*,RELEASE.sha256sum,RELEASE.md5sum - - publish_winget: - needs: update_release - runs-on: windows-latest - if: ${{ !inputs.dry_run }} - steps: - - name: Release winget package - uses: vedantmgoyal2009/winget-releaser@v2 - with: - version: ${{ inputs.version }} - release-tag: v${{ inputs.version }} - identifier: KRTirtho.Spotube - token: ${{ secrets.WINGET_TOKEN }} - - publish_flathub: - needs: update_release - runs-on: ubuntu-22.04 - steps: - - uses: actions/checkout@v3 - with: - repository: flathub/com.github.KRTirtho.Spotube - token: ${{ secrets.FLATHUB_TOKEN }} - - uses: actions/checkout@v3 - with: - path: spotube - - - name: Update flathub version - run: | - python3 spotube/scripts/update_flathub_version.py ${{ inputs.version }} - rm -rf spotube - git config --global user.email "krtirtho@gmail.com" - git config --global user.name "Kingkor Roy Tirtho" - git add . - git commit -m "v${{ inputs.version }} Update" - git branch update-${{ inputs.version }} - git switch update-${{ inputs.version }} - - - name: Push to flathub - if: ${{ !inputs.dry_run }} - run: git push -u origin update-${{ inputs.version }} - - publish_aur: - needs: update_release - runs-on: ubuntu-22.04 - steps: - - uses: actions/checkout@v3 - - - name: Download Linux artifacts - uses: actions/download-artifact@v3 - with: - name: Spotube-Linux-Bundle - path: ./Spotube-Linux-Bundle - - - name: Update PKGBUILD versions - run: | - sed -i "s/%{{SPOTUBE_VERSION}}%/${{ inputs.version }}/" aur-struct/PKGBUILD - sed -i "s/%{{PKGREL}}%/1/" aur-struct/PKGBUILD - sed -i "s/%{{LINUX_MD5}}%/`md5sum Spotube-Linux-Bundle/Spotube-linux-x86_64.tar.xz | awk '{print $1}'`/" aur-struct/PKGBUILD - - - name: Release to AUR - if: ${{ !inputs.dry_run }} - uses: KSXGitHub/github-actions-deploy-aur@v2.6.0 - with: - pkgname: spotube-bin - pkgbuild: aur-struct/PKGBUILD - commit_username: ${{ secrets.AUR_USERNAME }} - commit_email: ${{ secrets.AUR_EMAIL }} - ssh_private_key: ${{ secrets.AUR_SSH_PRIVATE_KEY }} - commit_message: Updated to v${{ inputs.version }} diff --git a/.vscode/settings.json b/.vscode/settings.json index 9f4bfc59..1b5691af 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -2,6 +2,7 @@ "cmake.configureOnOpen": false, "cSpell.words": [ "Mpris", - "Spotube" + "Spotube", + "winget" ] } From 51d83e18cc2e12ebb8e950688be6d5851a50b5c5 Mon Sep 17 00:00:00 2001 From: Kingkor Roy Tirtho Date: Wed, 15 Mar 2023 10:18:58 +0600 Subject: [PATCH 09/11] cd: use fork of flathub repo instead of the official --- .github/workflows/spotube-publish-binary.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/spotube-publish-binary.yml b/.github/workflows/spotube-publish-binary.yml index 1d297b1a..b8f07478 100644 --- a/.github/workflows/spotube-publish-binary.yml +++ b/.github/workflows/spotube-publish-binary.yml @@ -18,8 +18,8 @@ jobs: steps: - uses: actions/checkout@v3 with: - repository: flathub/com.github.KRTirtho.Spotube - token: ${{ secrets.FLATHUB_TOKEN }} + repository: KRTirtho/com.github.KRTirtho.Spotube + - uses: actions/checkout@v3 with: path: spotube @@ -36,7 +36,7 @@ jobs: git switch update-${{ inputs.version }} - name: Push to flathub - if: ${{ !inputs.dry_run }} + # if: ${{ !inputs.dry_run }} run: git push -u origin update-${{ inputs.version }} aur: From a11ff844b38bb84486df52efad123ddaadba0c1c Mon Sep 17 00:00:00 2001 From: Kingkor Roy Tirtho Date: Wed, 15 Mar 2023 10:28:57 +0600 Subject: [PATCH 10/11] cd: dry run true by default and flathub token in flathub job --- .github/workflows/spotube-publish-binary.yml | 9 ++++----- .github/workflows/spotube-release-binary.yml | 2 +- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/.github/workflows/spotube-publish-binary.yml b/.github/workflows/spotube-publish-binary.yml index b8f07478..05e549e6 100644 --- a/.github/workflows/spotube-publish-binary.yml +++ b/.github/workflows/spotube-publish-binary.yml @@ -10,7 +10,7 @@ on: description: Dry run required: true type: boolean - default: false + default: true jobs: flathub: @@ -19,6 +19,7 @@ jobs: - uses: actions/checkout@v3 with: repository: KRTirtho/com.github.KRTirtho.Spotube + token: ${{ secrets.FLATHUB_TOKEN }} - uses: actions/checkout@v3 with: @@ -89,10 +90,8 @@ jobs: token: ${{ secrets.GITHUB_TOKEN }} - name: Set up Chocolatey - run: | - choco apikey -k ${{ secrets.CHOCO_API_KEY }} -s https://push.chocolatey.org/ + run: choco apikey -k ${{ secrets.CHOCO_API_KEY }} -s https://push.chocolatey.org/ - name: Publish to Chocolatey Repository if: ${{ !inputs.dry_run }} - run: | - choco push Spotube-windows-x86_64.nupkg + run: choco push Spotube-windows-x86_64.nupkg diff --git a/.github/workflows/spotube-release-binary.yml b/.github/workflows/spotube-release-binary.yml index ec1ef70b..9a89e0f0 100644 --- a/.github/workflows/spotube-release-binary.yml +++ b/.github/workflows/spotube-release-binary.yml @@ -18,7 +18,7 @@ on: description: Dry run required: true type: boolean - default: false + default: true jobs: windows: From 0ac555c4e2b5b6003d9eeeefdfedd17436e8a6df Mon Sep 17 00:00:00 2001 From: Kingkor Roy Tirtho Date: Wed, 15 Mar 2023 10:31:46 +0600 Subject: [PATCH 11/11] cd: re enable dy run for flathub job --- .github/workflows/spotube-publish-binary.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/spotube-publish-binary.yml b/.github/workflows/spotube-publish-binary.yml index 05e549e6..94150a3e 100644 --- a/.github/workflows/spotube-publish-binary.yml +++ b/.github/workflows/spotube-publish-binary.yml @@ -37,7 +37,7 @@ jobs: git switch update-${{ inputs.version }} - name: Push to flathub - # if: ${{ !inputs.dry_run }} + if: ${{ !inputs.dry_run }} run: git push -u origin update-${{ inputs.version }} aur: