mirror of
https://github.com/KRTirtho/spotube.git
synced 2025-09-13 07:55:18 +00:00
307 lines
11 KiB
YAML
307 lines
11 KiB
YAML
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}}%|<release version="${{ inputs.version }}" date="${{ steps.date.outputs.date }}" />|' 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 }}
|