Publish #134
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Publish | |
on: | |
workflow_dispatch: | |
inputs: | |
version: | |
description: 'Version to bump to' | |
required: true | |
type: choice | |
options: | |
- patch | |
- minor | |
- major | |
update_frontend: | |
description: 'Try to pull latest changes from frontend repository (companion branch)' | |
required: false | |
type: boolean | |
default: true | |
jobs: | |
update_version: | |
permissions: | |
contents: write | |
runs-on: ubuntu-22.04 | |
outputs: | |
version: ${{ steps.semver.outputs.semantic-version }} | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
with: | |
submodules: true | |
- name: Update frontend | |
if: ${{ inputs.update_frontend == 'true' }} | |
run: | | |
cd frontend | |
git pull | |
cd .. | |
- id: semver | |
uses: SOLIDSoftworks/semver-tags@v1 | |
with: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN}} | |
tag-prefix: 'v' | |
incremented-value: ${{ inputs.version }} | |
- name: NPM-Version | |
uses: Reedyuk/NPM-Version@1.2.1 | |
with: | |
version: ${{ steps.semver.outputs.semantic-version }} | |
- name: Update cargo and tauri version | |
run: | | |
sudo apt install jq | |
sed -i '0,/\(version *= *\).*/s//\1"${{ steps.semver.outputs.semantic-version }}"/' src-tauri/Cargo.toml | |
jq '.version="${{ steps.semver.outputs.semantic-version }}"' src-tauri/tauri.conf.json > tauri.config.json.new && mv tauri.config.json.new src-tauri/tauri.conf.json | |
sed -i '/name = "music-assistant-companion"/{N;s/\(version *= *\)".*"/\1"'"${{ steps.semver.outputs.semantic-version }}"'"/;}' src-tauri/Cargo.lock | |
- name: Commit and push changes | |
run: | | |
git config --global user.name "Jonathan Bangert" | |
git config --global user.email "jonathan@bangert.dk" | |
git add -A | |
git commit -m "Update version to ${{ steps.semver.outputs.semantic-version }}" | |
git push | |
build: | |
needs: update_version | |
permissions: | |
contents: write | |
strategy: | |
fail-fast: false | |
matrix: | |
platform: [macos-latest, ubuntu-22.04, windows-latest, macos-12] | |
runs-on: ${{ matrix.platform }} | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
with: | |
submodules: true | |
- name: Pull latest changes | |
run: | | |
git pull | |
- name: Install dependencies (Linux) | |
if: matrix.platform == 'ubuntu-22.04' | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y libwebkit2gtk-4.1-dev build-essential curl wget file libxdo-dev libssl-dev libayatana-appindicator3-dev librsvg2-dev libsoup2.4-dev libjavascriptcoregtk-4.1-dev libxcb-xfixes0-dev libxcb-shape0-dev | |
- name: Install Rust (Stable) | |
run: | |
curl https://sh.rustup.rs -sSf | sh -s -- -y | |
- name: Install Rust aarch (Mac) | |
if: matrix.platform == 'macos-latest' | |
run: rustup target add aarch64-apple-darwin | |
- name: Rust cache | |
uses: swatinem/rust-cache@v2 | |
with: | |
workspaces: './src-tauri -> target' | |
cache-on-failure: true | |
- name: Sync node version and setup cache | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 'lts/*' | |
cache: 'yarn' # Set this to npm, yarn or pnpm. | |
- name: Install frontend dependencies | |
if: matrix.platform != 'windows-latest' | |
# If you don't have `beforeBuildCommand` configured you may want to build your frontend here too. | |
run: yarn install && cd $GITHUB_WORKSPACE/frontend/ && yarn install && cd $GITHUB_WORKSPACE # Change this to npm, yarn or pnpm. | |
- name: Install frontend dependencies (Windows) | |
if: matrix.platform == 'windows-latest' | |
# If you don't have `beforeBuildCommand` configured you may want to build your frontend here too. | |
run: yarn install && cd $env:GITHUB_WORKSPACE/frontend/ && yarn install && cd $env:GITHUB_WORKSPACE # Change this to npm, yarn or pnpm. | |
- name: Build the app (Linux) | |
if: matrix.platform == 'ubuntu-22.04' | |
uses: tauri-apps/tauri-action@v0 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }} | |
TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_KEY_PASSWORD }} | |
with: | |
tagName: v${{ needs.update_version.outputs.version }} | |
releaseName: "Music Assistant Companion App ${{ needs.update_version.outputs.version }}" | |
releaseBody: "Fixes" | |
- name: Build the app (Windows) | |
if: matrix.platform == 'windows-latest' | |
uses: tauri-apps/tauri-action@v0 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }} | |
TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_KEY_PASSWORD }} | |
with: | |
tagName: v${{ needs.update_version.outputs.version }} | |
releaseName: "Music Assistant Companion App ${{ needs.update_version.outputs.version }}" | |
releaseBody: "Fixes" | |
- name: Build the app (Mac (Apple Silicon)) | |
if: matrix.platform == 'macos-latest' | |
uses: tauri-apps/tauri-action@v0 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }} | |
TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_KEY_PASSWORD }} | |
APPLE_CERTIFICATE: ${{ secrets.APPLE_CERTIFICATE }} | |
APPLE_CERTIFICATE_PASSWORD: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }} | |
APPLE_SIGNING_IDENTITY: ${{ secrets.APPLE_SIGNING_IDENTITY }} | |
APPLE_ID: ${{ secrets.APPLE_ID }} | |
APPLE_PASSWORD: ${{ secrets.APPLE_PASSWORD }} | |
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }} | |
with: | |
args: --target aarch64-apple-darwin | |
tagName: v${{ needs.update_version.outputs.version }} | |
releaseName: "Music Assistant Companion App ${{ needs.update_version.outputs.version }}" | |
releaseBody: "Fixes" | |
# - name: Upload app to app store | |
# if: matrix.platform == 'macos-latest' | |
# run: | | |
# unset APPLE_SIGNING_IDENTITY | |
# unset APPLE_CERTIFICATE | |
# sign_app="3rd Party Mac Developer Application: COMPANY_NAME (TEAM_ID)" | |
# sign_install="3rd Party Mac Developer Installer: COMPANY_NAME (TEAM_ID)" | |
# profile="src-tauri/Mac_App_Distribution.provisionprofile" | |
# | |
# app_path="src-tauri/target/aarch64-apple-darwin/release/bundle/macos/Music Assistant Companion.app" | |
# build_name="src-tauri/target/aarch64-apple-darwin/release/bundle/macos/Music Assistant Companion.pkg" | |
# cp_dir="src-tauri/target/aarch64-apple-darwin/release/bundle/macos/Music Assistant Companion.app/Contents/embedded.provisionprofile" | |
# entitlements="src-tauri/Entitlements.plist" | |
# | |
# cp "${profile}" "${cp_dir}" | |
# | |
# codesign --deep --force -s "${sign_app}" --entitlements ${entitlements} "${app_path}" | |
# | |
# productbuild --component "${app_path}" /Applications/ --sign "${sign_install}" "${build_name}" | |
# | |
# xcrun altool --upload-app -f file -t platform -u username [-p password] | |
- name: Build the app (Mac) | |
if: matrix.platform == 'macos-12' | |
uses: tauri-apps/tauri-action@v0 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }} | |
TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_KEY_PASSWORD }} | |
APPLE_CERTIFICATE: ${{ secrets.APPLE_CERTIFICATE }} | |
APPLE_CERTIFICATE_PASSWORD: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }} | |
APPLE_SIGNING_IDENTITY: ${{ secrets.APPLE_SIGNING_IDENTITY }} | |
APPLE_ID: ${{ secrets.APPLE_ID }} | |
APPLE_PASSWORD: ${{ secrets.APPLE_PASSWORD }} | |
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }} | |
with: | |
tagName: v${{ needs.update_version.outputs.version }} | |
releaseName: "Music Assistant Companion App ${{ needs.update_version.outputs.version }}" | |
releaseBody: "Fixes" | |
- name: Upload linux binary | |
if: matrix.platform == 'ubuntu-22.04' | |
uses: svenstaro/upload-release-action@v2 | |
with: | |
tag: v${{ needs.update_version.outputs.version }} | |
asset_name: music-assistant-companion-${{ needs.update_version.outputs.version }} | |
file: src-tauri/target/release/music-assistant-companion | |
- name: Upload squeezelite binary | |
if: matrix.platform == 'ubuntu-22.04' | |
uses: svenstaro/upload-release-action@v2 | |
with: | |
tag: v${{ needs.update_version.outputs.version }} | |
file: src-tauri/bin/squeezelite-x86_64-unknown-linux-gnu |