name: Spotube Build & Release on: release: types: - published jobs: publish_chocolatey: 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: Get latest tag id: tag uses: dawidd6/action-get-tag@v1 with: # Optionally strip `v` prefix strip_v: true # Replace Version in files - run: | choco install sed make -y sed -i "s/%{{SPOTUBE_VERSION}}%/${{ steps.tag.outputs.tag }}/" windows/runner/Runner.rc sed -i "s/%{{SPOTUBE_VERSION}}%/${{ steps.tag.outputs.tag }}/" choco-struct/tools/VERIFICATION.txt sed -i "s/%{{SPOTUBE_VERSION}}%/${{ steps.tag.outputs.tag }}/" choco-struct/spotube.nuspec # Build Windows Executable - uses: subosito/flutter-action@v2.2.0 with: cache: true - run: | flutter config --enable-windows-desktop flutter pub get dart bin/create-secrets.dart '${{ secrets.LYRICS_SECRET }}' '${{ secrets.SPOTIFY_SECRET }}' dart pub global activate melos cd build/flutter_distributor && melos bootstrap && cd ../.. make innoinstall dart build/flutter_distributor/packages/flutter_distributor/bin/main.dart package --platform=windows --targets=exe --skip-clean # Create Chocolatey Package # setting the sha256 hash for new bundle - run: | mv dist/**/spotube-*-windows-setup.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 # Publish to Chocolatey Repository - 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' # Upload artifacts - uses: actions/upload-artifact@v3 with: name: Spotube-Windows-Bundle path: dist/ publish_macos: runs-on: macos-11 steps: - uses: actions/checkout@v2 - name: Get latest tag uses: dawidd6/action-get-tag@v1 id: tag with: strip_v: true - uses: subosito/flutter-action@v2 with: cache: true - 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 # using a versioned path for compatibility in gensums - run: mkdir -p build/${{ steps.tag.outputs.tag }} - run: appdmg appdmg.json build/${{ steps.tag.outputs.tag }}/Spotube-macos-x86_64.dmg - uses: actions/upload-artifact@v2 with: name: Spotube-Macos-Bundle path: | build/${{ steps.tag.outputs.tag }}/Spotube-macos-x86_64.dmg publish_linux: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - uses: actions/checkout@v3 with: repository: KRTirtho/flutter_distributor ref: deb-implementation path: build/flutter_distributor - name: Get latest tag id: tag uses: dawidd6/action-get-tag@v1 with: strip_v: true - uses: subosito/flutter-action@v2 with: cache: true - name: Get current date id: date run: echo "::set-output name=date::$(date +'%Y-%m-%d')" - run: | sudo apt-get update -y sudo apt-get install -y tar clang cmake ninja-build pkg-config libgtk-3-dev make libwebkit2gtk-4.0-dev keybinder-3.0 python3-pip python3-setuptools patchelf desktop-file-utils libgdk-pixbuf2.0-dev fakeroot strace fuse - run: | wget -O appimage-builder-x86_64.AppImage https://github.com/AppImageCrafters/appimage-builder/releases/download/v1.0.0-beta.1/appimage-builder-1.0.0-677acbd-x86_64.AppImage chmod +x appimage-builder-x86_64.AppImage mv appimage-builder-x86_64.AppImage /usr/local/bin/appimage-builder # replacing & adding new release version with older version - run: | sed -i 's|%{{APPDATA_RELEASE}}%||' linux/com.github.KRTirtho.Spotube.appdata.xml - run: | flutter config --enable-linux-desktop flutter pub get dart bin/create-secrets.dart '${{ secrets.LYRICS_SECRET }}' '${{ secrets.SPOTIFY_SECRET }}' dart pub global activate melos cd build/flutter_distributor && melos bootstrap && cd ../.. dart build/flutter_distributor/packages/flutter_distributor/bin/main.dart package --platform=linux --targets=deb,appimage --skip-clean make tar - 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.AppImage dist/Spotube-linux-x86_64.AppImage - uses: actions/upload-artifact@v3 with: name: Spotube-Linux-Bundle path: dist/ publish_android: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - uses: actions/checkout@v3 with: repository: KRTirtho/flutter_distributor ref: deb-implementation path: build/flutter_distributor - name: Get latest tag id: tag uses: dawidd6/action-get-tag@v1 with: strip_v: true - uses: subosito/flutter-action@v2 with: cache: true - run: | sudo apt-get update -y sudo apt-get install -y clang cmake ninja-build pkg-config libgtk-3-dev make libwebkit2gtk-4.0-dev keybinder-3.0 python3-pip python3-setuptools patchelf desktop-file-utils libgdk-pixbuf2.0-dev fakeroot strace fuse - run: | flutter pub get dart bin/create-secrets.dart '${{ secrets.LYRICS_SECRET }}' '${{ secrets.SPOTIFY_SECRET }}' dart pub global activate melos cd build/flutter_distributor && melos bootstrap && cd ../.. dart build/flutter_distributor/packages/flutter_distributor/bin/main.dart package --platform=android --targets=apk --skip-clean - run: | mv dist/**/spotube-*-android.apk dist/Spotube-android-all-arch.apk - uses: actions/upload-artifact@v3 with: name: Spotube-Android-Bundle path: dist/ update_release: needs: - publish_chocolatey - publish_macos - publish_linux - publish_android runs-on: ubuntu-latest 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: Get latest tag id: tag uses: dawidd6/action-get-tag@v1 with: strip_v: true - run: sudo apt-get install tree -y # generating checksums for all the binary - 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} > 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} > RELEASE.sha256sum sha256sum ./Spotube-Android-Bundle/*.apk > RELEASE.sha256sum sed -i 's|Spotube-.*-Bundle/||' RELEASE.sha256sum RELEASE.md5sum # Upload release binary - uses: ncipollo/release-action@v1 with: token: ${{ secrets.GITHUB_TOKEN }} tag: v${{ steps.tag.outputs.tag }} 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 # steps: # - name: Get latest tag # id: tag # uses: dawidd6/action-get-tag@v1 # with: # strip_v: true # - run: | # winget install wingetcreate --silent # choco install tree -y # wingetcreate update KRTirtho.Spotube --urls https://github.com/KRTirtho/spotube/releases/download/v${{ steps.tag.outputs.tag }}/Spotube-windows-x86_64-setup.exe https://github.com/KRTirtho/spotube/releases/download/v${{ steps.tag.outputs.tag }}/Spotube-windows-x86_64-setup.exe --version ${{ steps.tag.outputs.tag }} --token ${{ secrets.GITHUB_TOKEN }} --submit publish_flathub: needs: update_release runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 with: repository: flathub/com.github.KRTirtho.Spotube token: ${{ secrets.FLATHUB_TOKEN }} - uses: actions/checkout@v3 with: path: spotube - name: Get latest tag id: tag uses: dawidd6/action-get-tag@v1 with: strip_v: true - run: | python3 spotube/scripts/update_flathub_version.py ${{ steps.tag.outputs.tag }} - uses: EndBug/add-and-commit@v9 with: message: v${{ steps.tag.outputs.tag }} Update push: origin master publish_aur: needs: update_release runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - name: Get latest tag id: tag uses: dawidd6/action-get-tag@v1 with: strip_v: true - uses: actions/download-artifact@v3 with: name: Spotube-Linux-Bundle path: ./Spotube-Linux-Bundle - run: | sed -i "s/%{{SPOTUBE_VERSION}}%/${{ steps.tag.outputs.tag }}/" 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 - uses: KSXGitHub/github-actions-deploy-aur@v2.2.5 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${{ steps.tag.outputs.tag }}