Skip to content

Commit

Permalink
Merge pull request #79 from muzik-apps/main-app-dev
Browse files Browse the repository at this point in the history
Bringing changes downstream
  • Loading branch information
waveyboym authored Nov 27, 2024
2 parents 641c27e + 87ffccd commit ceece27
Show file tree
Hide file tree
Showing 110 changed files with 4,170 additions and 1,453 deletions.
95 changes: 95 additions & 0 deletions .github/workflows/build-and-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
name: 'build-and-release'

on:
workflow_dispatch:
push:
branches:
- releases

defaults:
run:
working-directory: ./muzik-offline # Navigate to the correct directory for all steps

jobs:
publish-tauri:
permissions:
contents: write
strategy:
fail-fast: false
matrix:
include:
- platform: 'macos-latest' # for Arm based macs (M1 and above).
args: '--target aarch64-apple-darwin'
rust-version: "1.77.2"
- platform: 'macos-latest' # for Intel based macs.
args: '--target x86_64-apple-darwin'
rust-version: "1.77.2"
- platform: 'ubuntu-22.04'
args: ''
rust-version: "stable"
- platform: 'windows-latest'
args: ''
rust-version: "stable"

runs-on: ${{ matrix.platform }}
steps:
- uses: actions/checkout@v4
- name: install dependencies (ubuntu only)
if: matrix.platform == 'ubuntu-22.04'
# This must match the platform value defined above.
run: |
sudo apt-get update
sudo apt-get install -y libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf libasound2-dev
- name: setup node
uses: actions/setup-node@v4
with:
node-version: lts/*
cache: 'npm' # Set this to npm, yarn or pnpm.
cache-dependency-path: './muzik-offline/package-lock.json' # Change this to your lock file path.

- name: install Rust stable
uses: dtolnay/rust-toolchain@master # Set this to dtolnay/rust-toolchain@nightly
with:
# Those targets are only used on macos runners so it's in an `if` to slightly speed up windows and linux builds.
targets: ${{ matrix.platform == 'macos-latest' && 'aarch64-apple-darwin,x86_64-apple-darwin' || '' }}
toolchain: ${{ matrix.rust-version }}

- name: Rust cache
uses: swatinem/rust-cache@v2
with:
workspaces: './src-tauri -> target'

- name: install frontend dependencies
# If you don't have `beforeBuildCommand` configured you may want to build your frontend here too.
run: npm ci # change this to npm or pnpm depending on which one you use.

- name: Install OpenSSL on macOS
if: matrix.platform == 'macos-latest'
run: brew install openssl

- name: Install OpenSSL on Ubuntu
if: matrix.platform == 'ubuntu-22.04'
run: sudo apt-get update && sudo apt-get install -y openssl

- name: Install OpenSSL on Windows
if: matrix.platform == 'windows-latest'
run: choco install openssl -y

- name: Verify OpenSSL Installation
run: openssl version

- name: Decrypt the environment variables in src-tauri/.env.enc
run: |
openssl enc -d -aes-256-cbc -pbkdf2 -in src-tauri/.env.enc -out src-tauri/.env -pass pass:${{ secrets.ENCRYPTION_PASSWORD }}
- uses: tauri-apps/tauri-action@v0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tagName: v__VERSION__ # the action automatically replaces \_\_VERSION\_\_ with the app version.
releaseName: 'v__VERSION__-Speeding things up(patch)'
releaseBody: 'See the assets to download this version and install.'
releaseDraft: true
prerelease: false
args: ${{ matrix.args }}
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2024 muzik-offline

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
21 changes: 6 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,28 +66,19 @@ DISCORD_CLIENT_ID=<Your client id goes here>
```
npm run tauri dev
```
11. You can encrypt your env file with:
```
openssl enc -aes-256-cbc -salt -pbkdf2 -in src-tauri/.env -out src-tauri/.env.enc -pass pass:{pass-key}
```

## Building
1. Clone the <a href="https://github.com/muzik-apps/muzik-offline/tree/releases">releases</a> branch. It is the most stable and ready to go branch
2. Before you create a build, you will have to embed any env variables into the rust code otherwise the application will panic if you try to run it. The env variables are only meant to be used in the development cycle.
3. To embed the env variables, copy your ```DISCORD_CLIENT_ID``` from the ```.env``` file.
4. Go to <a href="https://github.com/muzik-apps/muzik-offline/blob/main-app-dev/muzik-offline/src-tauri/src/socials/discord_rpc.rs">discord_rpc.rs</a> and comment out these snippets of code:
```
3 -> use dotenv::dotenv;
4 -> use std::env;
15 -> //get client id from env variables
16 -> dotenv().ok();
17 -> let client_id = env::var("DISCORD_CLIENT_ID").expect("DISCORD_CLIENT_ID env variable not set");
```
5. In this snippet of code ```let client: DiscordIpcClient = DiscordIpcClient::new(&client_id)?;```, replace ```&client_id``` with ```"<Your client id goes here>"```
6. You can also remove the <a href="https://github.com/muzik-apps/muzik-offline/blob/main-app-dev/muzik-offline/src-tauri/Cargo.toml#L30">dotnev crate</a> by just removing that line of code.
7. If you want to go back to dev, you will have to undo all the steps above.
8. If you want to create a production build, run
4. If you want to create a production build, run
```
npm run tauri build
```
9. If you want to create a <a href="https://tauri.app/v1/guides/debugging/application#using-the-inspector-in-production">debug production build</a>(one where you have access to devtools), run
5. If you want to create a <a href="https://tauri.app/v1/guides/debugging/application#using-the-inspector-in-production">debug production build</a>(one where you have access to devtools), run
```
npm run tauri build -- --debug
```
Expand Down
4 changes: 2 additions & 2 deletions muzik-offline/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion muzik-offline/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "muzik-offline",
"private": true,
"version": "0.6.0",
"version": "0.7.0",
"type": "module",
"scripts": {
"dev": "vite",
Expand Down
1 change: 1 addition & 0 deletions muzik-offline/src-tauri/.env.enc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Salted__B�Tu��Lb�ne������m�`�d�>����5:�ܓ���Q�$�͜��x��ﱔQQ�B!/�oj�v6+��2���p> <;��{O/Hp2|ڿ�=Bu��T��n�.?�?jc>�z�W��=
Expand Down
3 changes: 2 additions & 1 deletion muzik-offline/src-tauri/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@
.vscode/
.VSCodeCounter/
/db/
.env
.env
OUTDIR/
Loading

0 comments on commit ceece27

Please sign in to comment.