fix: prevent duplicate tray icons on macOS webview reload #22
Workflow file for this run
This file contains hidden or 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: Build and Release | |
| on: | |
| push: | |
| tags: | |
| - 'v*' | |
| workflow_dispatch: | |
| inputs: | |
| version: | |
| description: 'Version tag (e.g., v1.0.0)' | |
| required: true | |
| default: 'v1.0.0' | |
| permissions: | |
| contents: write | |
| env: | |
| CARGO_TERM_COLOR: always | |
| jobs: | |
| create-release: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| release_id: ${{ steps.create-release.outputs.id }} | |
| upload_url: ${{ steps.create-release.outputs.upload_url }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Get version from tag | |
| id: get_version | |
| run: | | |
| if [ "${{ github.event_name }}" == "workflow_dispatch" ]; then | |
| echo "version=${{ github.event.inputs.version }}" >> $GITHUB_OUTPUT | |
| else | |
| echo "version=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Extract changelog for version | |
| id: changelog | |
| run: | | |
| VERSION="${{ steps.get_version.outputs.version }}" | |
| VERSION_NUM="${VERSION#v}" | |
| # Extract changelog section for this version (from ## [VERSION] to next ## [) | |
| CHANGELOG=$(awk "/^## \[${VERSION_NUM}\]/{flag=1; next} /^## \[/{if(flag) exit} flag" CHANGELOG.md) | |
| # If no changelog found, use default message | |
| if [ -z "$CHANGELOG" ]; then | |
| CHANGELOG="See CHANGELOG.md for details." | |
| fi | |
| # Write to file and escape for use in GitHub Actions | |
| { | |
| echo "## Downloads" | |
| echo "" | |
| echo "### Desktop App" | |
| echo "| Platform | File |" | |
| echo "|----------|------|" | |
| echo "| Windows | \`.msi\` or \`.exe\` |" | |
| echo "| macOS Intel | \`.dmg\` (x64) |" | |
| echo "| macOS Apple Silicon | \`.dmg\` (aarch64) |" | |
| echo "| Linux | \`.deb\` / \`.rpm\` / \`.AppImage\` |" | |
| echo "" | |
| echo "**macOS:** Run \`xattr -cr /Applications/DLMan.app\` after install." | |
| echo "" | |
| echo "### Browser Extension" | |
| echo "| Browser | File |" | |
| echo "|---------|------|" | |
| echo "| Chrome / Edge / Brave | \`dlman-extension-chrome-*.zip\` |" | |
| echo "| Firefox | \`dlman-extension-firefox-*.zip\` |" | |
| echo "" | |
| echo "**Install:** Extract and load as unpacked extension, or submit to browser stores." | |
| echo "" | |
| echo "---" | |
| echo "" | |
| echo "$CHANGELOG" | |
| } > /tmp/release_body.txt | |
| echo "changelog_file=/tmp/release_body.txt" >> $GITHUB_OUTPUT | |
| - name: Create Release | |
| id: create-release | |
| uses: softprops/action-gh-release@v2 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| tag_name: ${{ steps.get_version.outputs.version }} | |
| name: DLMan ${{ steps.get_version.outputs.version }} | |
| body_path: /tmp/release_body.txt | |
| draft: false | |
| prerelease: false | |
| build-tauri: | |
| needs: create-release | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - platform: macos-latest | |
| target: x86_64-apple-darwin | |
| args: '--target x86_64-apple-darwin' | |
| - platform: macos-latest | |
| target: aarch64-apple-darwin | |
| args: '--target aarch64-apple-darwin' | |
| - platform: ubuntu-22.04 | |
| target: x86_64-unknown-linux-gnu | |
| args: '' | |
| - platform: windows-latest | |
| target: x86_64-pc-windows-msvc | |
| args: '' | |
| runs-on: ${{ matrix.platform }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| - name: Setup pnpm | |
| uses: pnpm/action-setup@v3 | |
| with: | |
| version: 9 | |
| - name: Get pnpm store directory | |
| shell: bash | |
| run: | | |
| echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV | |
| - name: Setup pnpm cache | |
| uses: actions/cache@v3 | |
| with: | |
| path: ${{ env.STORE_PATH }} | |
| key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} | |
| restore-keys: | | |
| ${{ runner.os }}-pnpm-store- | |
| - name: Setup Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| targets: ${{ matrix.target }} | |
| - name: Setup Rust cache | |
| uses: Swatinem/rust-cache@v2 | |
| with: | |
| workspaces: '. -> target' | |
| - name: Install Rust target (macOS cross-compile) | |
| if: matrix.platform == 'macos-latest' | |
| run: rustup target add ${{ matrix.target }} | |
| - name: Install dependencies (Ubuntu) | |
| if: matrix.platform == 'ubuntu-22.04' | |
| run: | | |
| # Remove problematic Microsoft repos that cause 403 errors | |
| sudo rm -f /etc/apt/sources.list.d/microsoft-prod.list | |
| sudo rm -f /etc/apt/sources.list.d/azure-cli.list | |
| sudo apt-get update | |
| sudo apt-get install -y \ | |
| libwebkit2gtk-4.1-dev \ | |
| libayatana-appindicator3-dev \ | |
| librsvg2-dev \ | |
| patchelf \ | |
| libgtk-3-dev | |
| - name: Install frontend dependencies | |
| run: pnpm install --frozen-lockfile | |
| - name: Build Tauri app | |
| uses: tauri-apps/tauri-action@v0 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| releaseId: ${{ needs.create-release.outputs.release_id }} | |
| projectPath: apps/desktop | |
| tauriScript: pnpm tauri | |
| build-extension: | |
| needs: create-release | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| - name: Setup pnpm | |
| uses: pnpm/action-setup@v3 | |
| with: | |
| version: 9 | |
| - name: Install dependencies | |
| run: pnpm install | |
| - name: Get version | |
| id: get_version | |
| run: | | |
| if [ "${{ github.event_name }}" == "workflow_dispatch" ]; then | |
| echo "version=${{ github.event.inputs.version }}" >> $GITHUB_OUTPUT | |
| else | |
| echo "version=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Update extension version | |
| run: | | |
| VERSION="${{ steps.get_version.outputs.version }}" | |
| VERSION_NUM="${VERSION#v}" | |
| cd apps/extension | |
| # Update version in package.json and wxt.config.ts manifest | |
| sed -i "s/\"version\": \"[^\"]*\"/\"version\": \"${VERSION_NUM}\"/" package.json | |
| sed -i "s/version: '[^']*'/version: '${VERSION_NUM}'/" wxt.config.ts | |
| - name: Upload release notes and source | |
| uses: softprops/action-gh-release@v2 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| tag_name: ${{ steps.get_version.outputs.version }} | |
| body: "v${{ steps.get_version.outputs.version }} release" |