From 15bc547b3603294ada3a6771bd6863551c9be2fa Mon Sep 17 00:00:00 2001 From: Tsiry Sandratraina Date: Mon, 5 Dec 2022 22:29:22 +0300 Subject: [PATCH] ci: configure desktop release fix ci ci: add desktop release for aarch64-apple-darwin ci: release artifacts bump version code update release-desktop.yml fix ci fix ci fix ci fix ci fix ci fix ci fix ci fix ci fix ci fix ci --- .github/workflows/release-desktop.yml | 142 ++++++++++++++++++++ Cargo.lock | 2 +- Cargo.toml | 2 +- webui/musicplayer/package.json | 3 +- webui/musicplayer/src-tauri/tauri.conf.json | 10 +- 5 files changed, 152 insertions(+), 7 deletions(-) create mode 100644 .github/workflows/release-desktop.yml diff --git a/.github/workflows/release-desktop.yml b/.github/workflows/release-desktop.yml new file mode 100644 index 00000000..843392df --- /dev/null +++ b/.github/workflows/release-desktop.yml @@ -0,0 +1,142 @@ +on: + release: + types: [created] +#on: +# push: +# branches: ["master"] +# pull_request: +# # The branches below must be a subset of the branches above +# branches: ["master"] + +jobs: + release: + strategy: + fail-fast: false + matrix: + platform: [macos-latest, ubuntu-20.04, windows-latest] + runs-on: ${{ matrix.platform }} + + steps: + - uses: actions/checkout@v3 + - name: setup node + uses: actions/setup-node@v3 + with: + node-version: 16 + - uses: actions/cache@v3 + with: + path: | + ~/.cargo/bin/ + ~/.cargo/registry/index/ + ~/.cargo/registry/cache/ + ~/.cargo/git/db/ + target/ + key: ${{ matrix.platform }}-cargo-${{ hashFiles('**/Cargo.lock') }} + - name: Install dependencies (mac) only) + if: matrix.platform == 'macos-latest' + run: brew install protobuf + - name: Install dependencies (ubuntu only) + if: matrix.platform == 'ubuntu-20.04' + run: | + sudo apt-get update + sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.0-dev libappindicator3-dev librsvg2-dev patchelf libasound2-dev protobuf-compiler + - name: Install dependencies (windows only) + if: matrix.platform == 'windows-latest' + run: | + choco install protoc + choco install checksum + - name: Install Node Modules + run: | + cd webui/musicplayer + npm install -g yarn + yarn install --network-timeout 1000000000 + - name: Install Rust toolchain + uses: actions-rs/toolchain@v1 + with: + toolchain: stable + override: true + - name: Install aarch64-apple-darwin toolchain + if: matrix.platform == 'macos-latest' + run: rustup target add aarch64-apple-darwin + - name: Build App + run: | + cd webui/musicplayer + npx @tauri-apps/cli build + - name: Build App (macos arch64-apple-darwin) + if: matrix.platform == 'macos-latest' + run: | + cd webui/musicplayer + npx @tauri-apps/cli build --target aarch64-apple-darwin + - name: List files + if: matrix.platform == 'ubuntu-20.04' || matrix.platform == 'macos-latest' + run: | + ls target/release/bundle/* + - name: List files (windows) + if: matrix.platform == 'windows-latest' + run: | + dir target\release\bundle + dir target\release\bundle\* + - name: Set env + if: matrix.platform == 'ubuntu-20.04' || matrix.platform == 'macos-latest' + run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV + - name: Create archive (macos) + if: matrix.platform == 'macos-latest' + run: | + cd target/release/bundle + rm -f music-player-desktop_${{ env.RELEASE_VERSION }}_x86_64-apple-darwin.tar.gz + tar -czvf music-player-desktop_${{ env.RELEASE_VERSION }}_x86_64-apple-darwin.tar.gz "macos/Music Player.app" + shasum -a 256 music-player-desktop_${{ env.RELEASE_VERSION }}_x86_64-apple-darwin.tar.gz > music-player-desktop_${{ env.RELEASE_VERSION }}_x86_64-apple-darwin.tar.gz.sha256 + rm -f dmg/Music_Player_${{ env.RELEASE_VERSION }}_x64.dmg + mv dmg/Music\ Player*_x64.dmg dmg/Music_Player_${{ env.RELEASE_VERSION }}_x64.dmg + shasum -a 256 dmg/Music_Player_${{ env.RELEASE_VERSION }}_x64.dmg > dmg/Music_Player_${{ env.RELEASE_VERSION }}_x64.dmg.sha256 + cd ../../aarch64-apple-darwin/release/bundle + rm -f music-player-desktop_${{ env.RELEASE_VERSION }}_aarch64-apple-darwin.tar.gz + tar -czvf music-player-desktop_${{ env.RELEASE_VERSION }}_aarch64-apple-darwin.tar.gz "macos/Music Player.app" + shasum -a 256 music-player-desktop_${{ env.RELEASE_VERSION }}_aarch64-apple-darwin.tar.gz > music-player-desktop_${{ env.RELEASE_VERSION }}_aarch64-apple-darwin.tar.gz.sha256 + rm -f dmg/Music_Player_${{ env.RELEASE_VERSION }}_aarch64.dmg + mv dmg/Music\ Player*_aarch64.dmg dmg/Music_Player_${{ env.RELEASE_VERSION }}_aarch64.dmg + shasum -a 256 dmg/Music_Player_${{ env.RELEASE_VERSION }}_aarch64.dmg > dmg/Music_Player_${{ env.RELEASE_VERSION }}_aarch64.dmg.sha256 + - name: Releasing artifacts (macos) + if: matrix.platform == 'macos-latest' + uses: softprops/action-gh-release@v1 + with: + files: | + target/release/bundle/music-player-desktop_${{ env.RELEASE_VERSION }}_x86_64-apple-darwin.tar.gz + target/release/bundle/music-player-desktop_${{ env.RELEASE_VERSION }}_x86_64-apple-darwin.tar.gz.sha256 + target/release/bundle/dmg/Music_Player_${{ env.RELEASE_VERSION }}_x64.dmg + target/release/bundle/dmg/Music_Player_${{ env.RELEASE_VERSION }}_x64.dmg.sha256 + target/aarch64-apple-darwin/release/bundle/music-player-desktop_${{ env.RELEASE_VERSION }}_aarch64-apple-darwin.tar.gz + target/aarch64-apple-darwin/release/bundle/music-player-desktop_${{ env.RELEASE_VERSION }}_aarch64-apple-darwin.tar.gz.sha256 + target/aarch64-apple-darwin/release/bundle/dmg/Music_Player_${{ env.RELEASE_VERSION }}_aarch64.dmg + target/aarch64-apple-darwin/release/bundle/dmg/Music_Player_${{ env.RELEASE_VERSION }}_aarch64.dmg.sha256 + - name: Hash files (ubuntu) + if: matrix.platform == 'ubuntu-20.04' + run: | + rm -f target/release/bundle/deb/music-player_${{ env.RELEASE_VERSION }}_amd64.deb + rm -f target/release/bundle/appimage/music-player_${{ env.RELEASE_VERSION }}_amd64.AppImage + mv target/release/bundle/appimage/music-player*.AppImage target/release/bundle/appimage/music-player_${{ env.RELEASE_VERSION }}_amd64.AppImage + mv target/release/bundle/deb/music-player*.deb target/release/bundle/deb/music-player_${{ env.RELEASE_VERSION }}_amd64.deb + shasum -a 256 target/release/bundle/appimage/music-player_${{ env.RELEASE_VERSION }}_amd64.AppImage > target/release/bundle/appimage/music-player_${{ env.RELEASE_VERSION }}_amd64.AppImage.sha256 + shasum -a 256 target/release/bundle/deb/music-player_${{ env.RELEASE_VERSION }}_amd64.deb > target/release/bundle/deb/music-player_${{ env.RELEASE_VERSION }}_amd64.deb.sha256 + - name: Releasing artifacts (ubuntu) + if: matrix.platform == 'ubuntu-20.04' + uses: softprops/action-gh-release@v1 + with: + files: | + target/release/bundle/appimage/music-player_${{ env.RELEASE_VERSION }}_amd64.AppImage + target/release/bundle/appimage/music-player_${{ env.RELEASE_VERSION }}_amd64.AppImage.sha256 + target/release/bundle/deb/music-player_${{ env.RELEASE_VERSION }}_amd64.deb + target/release/bundle/deb/music-player_${{ env.RELEASE_VERSION }}_amd64.deb.sha256 + - name: Hash files (windows) + if: matrix.platform == 'windows-latest' + run: | + Remove-Item -Force target/release/bundle/msi/Music_Player_x64_en-US.msi + move target/release/bundle/msi/Music*.msi target/release/bundle/msi/Music_Player_x64_en-US.msi + checksum -t sha256 -f="target/release/bundle/msi/Music_Player_x64_en-US.msi" > target/release/bundle/msi/Music_Player_x64_en-US.msi.sha256 + - name: Releasing artifacts (windows) + if: matrix.platform == 'windows-latest' + uses: softprops/action-gh-release@v1 + with: + files: | + target/release/bundle/msi/Music_Player_x64_en-US.msi + target/release/bundle/msi/Music_Player_x64_en-US.msi.sha256 + \ No newline at end of file diff --git a/Cargo.lock b/Cargo.lock index e25a46d3..d0cd4169 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3706,7 +3706,7 @@ dependencies = [ [[package]] name = "music-player" -version = "0.2.0-alpha.7" +version = "0.2.0-alpha.8" dependencies = [ "clap", "crossterm", diff --git a/Cargo.toml b/Cargo.toml index f9f67045..790bb5c8 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "music-player" -version = "0.2.0-alpha.7" +version = "0.2.0-alpha.8" edition = "2021" repository = "https://github.com/tsirysndr/music-player" license = "MIT" diff --git a/webui/musicplayer/package.json b/webui/musicplayer/package.json index 1ef53b59..22222615 100644 --- a/webui/musicplayer/package.json +++ b/webui/musicplayer/package.json @@ -41,6 +41,7 @@ "scripts": { "start": "react-scripts start", "build": "cross-env CI=false react-scripts build", + "tauri:build": "cross-env CI=false BROWSER=none REACT_APP_NATIVE_WRAPPER=tauri react-scripts build", "tauri:dev": "cross-env BROWSER=none REACT_APP_NATIVE_WRAPPER=tauri react-scripts start", "test": "react-scripts test", "eject": "react-scripts eject", @@ -100,4 +101,4 @@ "prop-types": "^15.8.1", "webpack": "^5.74.0" } -} +} \ No newline at end of file diff --git a/webui/musicplayer/src-tauri/tauri.conf.json b/webui/musicplayer/src-tauri/tauri.conf.json index b45087b7..1fd2bc6e 100644 --- a/webui/musicplayer/src-tauri/tauri.conf.json +++ b/webui/musicplayer/src-tauri/tauri.conf.json @@ -1,6 +1,6 @@ { "build": { - "beforeBuildCommand": "yarn build", + "beforeBuildCommand": "yarn tauri:build", "beforeDevCommand": "yarn tauri:dev", "devPath": "http://localhost:3000", "distDir": "../build", @@ -18,7 +18,9 @@ "protocol": { "all": false, "asset": true, - "assetScope": ["$APPLOCALDATA/covers/*"] + "assetScope": [ + "$APPLOCALDATA/covers/*" + ] } }, "bundle": { @@ -55,7 +57,7 @@ } }, "security": { - "csp": "default-src 'self'; img-src 'self' asset: https://asset.localhost" + "csp": "img-src 'self' asset: https://asset.localhost" }, "updater": { "active": false @@ -70,4 +72,4 @@ } ] } -} +} \ No newline at end of file