fix: correct GUI artifact path in release workflow #20
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: Release | |
| on: | |
| push: | |
| tags: | |
| - "v*" | |
| permissions: | |
| contents: write | |
| jobs: | |
| build-cli: | |
| name: Build CLI for ${{ matrix.target }} | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| matrix: | |
| include: | |
| - target: x86_64-apple-darwin | |
| os: macos-latest | |
| - target: aarch64-apple-darwin | |
| os: macos-latest | |
| - target: x86_64-unknown-linux-gnu | |
| os: ubuntu-latest | |
| - target: x86_64-pc-windows-msvc | |
| os: windows-latest | |
| - target: aarch64-pc-windows-msvc | |
| os: windows-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install Rust | |
| uses: dtolnay/rust-toolchain@4be9e76fd7c4901c61fb841f559994984270fce7 # stable | |
| with: | |
| targets: ${{ matrix.target }} | |
| - name: Build | |
| run: cargo build --release --features replaygain --target ${{ matrix.target }} | |
| env: | |
| RUSTFLAGS: ${{ contains(matrix.target, 'windows') && '-C target-feature=+crt-static' || '' }} | |
| - name: Upload artifact (Unix) | |
| if: runner.os != 'Windows' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: mp3rgain-${{ matrix.target }} | |
| path: target/${{ matrix.target }}/release/mp3rgain | |
| - name: Upload artifact (Windows) | |
| if: runner.os == 'Windows' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: mp3rgain-${{ matrix.target }} | |
| path: target/${{ matrix.target }}/release/mp3rgain.exe | |
| build-gui: | |
| name: Build GUI for ${{ matrix.target }} | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| matrix: | |
| include: | |
| - target: x86_64-apple-darwin | |
| os: macos-latest | |
| - target: aarch64-apple-darwin | |
| os: macos-latest | |
| - target: x86_64-unknown-linux-gnu | |
| os: ubuntu-latest | |
| - target: x86_64-pc-windows-msvc | |
| os: windows-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install Rust | |
| uses: dtolnay/rust-toolchain@4be9e76fd7c4901c61fb841f559994984270fce7 # stable | |
| with: | |
| targets: ${{ matrix.target }} | |
| - name: Install Linux dependencies | |
| if: runner.os == 'Linux' | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y libxkbcommon-dev libwayland-dev libgtk-3-dev | |
| - name: Build GUI | |
| run: cargo build --release --manifest-path mp3rgui/Cargo.toml --target ${{ matrix.target }} | |
| env: | |
| RUSTFLAGS: ${{ contains(matrix.target, 'windows') && '-C target-feature=+crt-static' || '' }} | |
| - name: Upload artifact (Unix) | |
| if: runner.os != 'Windows' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: mp3rgui-${{ matrix.target }} | |
| path: mp3rgui/target/${{ matrix.target }}/release/mp3rgui | |
| - name: Upload artifact (Windows) | |
| if: runner.os == 'Windows' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: mp3rgui-${{ matrix.target }} | |
| path: mp3rgui/target/${{ matrix.target }}/release/mp3rgui.exe | |
| release: | |
| name: Create Release | |
| needs: [build-cli, build-gui] | |
| runs-on: macos-latest | |
| outputs: | |
| version: ${{ steps.version.outputs.version }} | |
| windows_x64_sha256: ${{ steps.checksums.outputs.windows_x64_sha256 }} | |
| windows_arm64_sha256: ${{ steps.checksums.outputs.windows_arm64_sha256 }} | |
| macos_sha256: ${{ steps.checksums.outputs.macos_sha256 }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Get version | |
| id: version | |
| run: echo "version=${GITHUB_REF_NAME#v}" >> $GITHUB_OUTPUT | |
| - name: Download all artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: artifacts | |
| - name: Create universal macOS binary | |
| run: | | |
| mkdir -p dist | |
| lipo -create \ | |
| artifacts/mp3rgain-x86_64-apple-darwin/mp3rgain \ | |
| artifacts/mp3rgain-aarch64-apple-darwin/mp3rgain \ | |
| -output dist/mp3rgain | |
| chmod +x dist/mp3rgain | |
| - name: Create macOS tarball | |
| run: | | |
| cd dist | |
| tar -czvf mp3rgain-${{ github.ref_name }}-macos-universal.tar.gz mp3rgain | |
| shasum -a 256 mp3rgain-${{ github.ref_name }}-macos-universal.tar.gz > mp3rgain-${{ github.ref_name }}-macos-universal.tar.gz.sha256 | |
| - name: Create Linux tarball | |
| run: | | |
| cd artifacts/mp3rgain-x86_64-unknown-linux-gnu | |
| chmod +x mp3rgain | |
| tar -czvf ../../dist/mp3rgain-${{ github.ref_name }}-linux-x86_64.tar.gz mp3rgain | |
| cd ../../dist | |
| shasum -a 256 mp3rgain-${{ github.ref_name }}-linux-x86_64.tar.gz > mp3rgain-${{ github.ref_name }}-linux-x86_64.tar.gz.sha256 | |
| - name: Create Windows x86_64 zip | |
| run: | | |
| cd artifacts/mp3rgain-x86_64-pc-windows-msvc | |
| zip ../../dist/mp3rgain-${{ github.ref_name }}-windows-x86_64.zip mp3rgain.exe | |
| cd ../../dist | |
| shasum -a 256 mp3rgain-${{ github.ref_name }}-windows-x86_64.zip > mp3rgain-${{ github.ref_name }}-windows-x86_64.zip.sha256 | |
| - name: Create Windows ARM64 zip | |
| run: | | |
| cd artifacts/mp3rgain-aarch64-pc-windows-msvc | |
| zip ../../dist/mp3rgain-${{ github.ref_name }}-windows-arm64.zip mp3rgain.exe | |
| cd ../../dist | |
| shasum -a 256 mp3rgain-${{ github.ref_name }}-windows-arm64.zip > mp3rgain-${{ github.ref_name }}-windows-arm64.zip.sha256 | |
| - name: Create GUI universal macOS binary | |
| run: | | |
| lipo -create \ | |
| artifacts/mp3rgui-x86_64-apple-darwin/mp3rgui \ | |
| artifacts/mp3rgui-aarch64-apple-darwin/mp3rgui \ | |
| -output dist/mp3rgui | |
| chmod +x dist/mp3rgui | |
| tar -czvf dist/mp3rgui-${{ github.ref_name }}-macos-universal.tar.gz -C dist mp3rgui | |
| rm dist/mp3rgui | |
| - name: Create GUI Linux tarball | |
| run: | | |
| cd artifacts/mp3rgui-x86_64-unknown-linux-gnu | |
| chmod +x mp3rgui | |
| tar -czvf ../../dist/mp3rgui-${{ github.ref_name }}-linux-x86_64.tar.gz mp3rgui | |
| - name: Create GUI Windows zip | |
| run: | | |
| cd artifacts/mp3rgui-x86_64-pc-windows-msvc | |
| zip ../../dist/mp3rgui-${{ github.ref_name }}-windows-x86_64.zip mp3rgui.exe | |
| - name: Extract checksums | |
| id: checksums | |
| run: | | |
| echo "windows_x64_sha256=$(cat dist/mp3rgain-${{ github.ref_name }}-windows-x86_64.zip.sha256 | awk '{print $1}')" >> $GITHUB_OUTPUT | |
| echo "windows_arm64_sha256=$(cat dist/mp3rgain-${{ github.ref_name }}-windows-arm64.zip.sha256 | awk '{print $1}')" >> $GITHUB_OUTPUT | |
| echo "macos_sha256=$(cat dist/mp3rgain-${{ github.ref_name }}-macos-universal.tar.gz.sha256 | awk '{print $1}')" >> $GITHUB_OUTPUT | |
| - name: Create Release | |
| uses: softprops/action-gh-release@c95fe1489396fe8a9eb87c0abf8aa5b2ef267fda # v2 | |
| with: | |
| files: | | |
| dist/mp3rgain-${{ github.ref_name }}-macos-universal.tar.gz | |
| dist/mp3rgain-${{ github.ref_name }}-macos-universal.tar.gz.sha256 | |
| dist/mp3rgain-${{ github.ref_name }}-linux-x86_64.tar.gz | |
| dist/mp3rgain-${{ github.ref_name }}-linux-x86_64.tar.gz.sha256 | |
| dist/mp3rgain-${{ github.ref_name }}-windows-x86_64.zip | |
| dist/mp3rgain-${{ github.ref_name }}-windows-x86_64.zip.sha256 | |
| dist/mp3rgain-${{ github.ref_name }}-windows-arm64.zip | |
| dist/mp3rgain-${{ github.ref_name }}-windows-arm64.zip.sha256 | |
| dist/mp3rgui-${{ github.ref_name }}-macos-universal.tar.gz | |
| dist/mp3rgui-${{ github.ref_name }}-linux-x86_64.tar.gz | |
| dist/mp3rgui-${{ github.ref_name }}-windows-x86_64.zip | |
| draft: true | |
| generate_release_notes: false | |
| # Update Scoop bucket | |
| update-scoop: | |
| name: Update Scoop Bucket | |
| needs: release | |
| runs-on: ubuntu-latest | |
| continue-on-error: true | |
| steps: | |
| - name: Checkout scoop-bucket | |
| uses: actions/checkout@v4 | |
| with: | |
| repository: M-Igashi/scoop-bucket | |
| token: ${{ secrets.SCOOP_BUCKET_TOKEN }} | |
| path: scoop-bucket | |
| - name: Update manifest | |
| run: | | |
| cd scoop-bucket | |
| cat > mp3rgain.json << 'EOF' | |
| { | |
| "version": "${{ needs.release.outputs.version }}", | |
| "description": "Lossless MP3 volume adjustment - a modern mp3gain replacement written in Rust", | |
| "homepage": "https://github.com/M-Igashi/mp3rgain", | |
| "license": "MIT", | |
| "architecture": { | |
| "64bit": { | |
| "url": "https://github.com/M-Igashi/mp3rgain/releases/download/${{ github.ref_name }}/mp3rgain-${{ github.ref_name }}-windows-x86_64.zip", | |
| "hash": "${{ needs.release.outputs.windows_x64_sha256 }}" | |
| }, | |
| "arm64": { | |
| "url": "https://github.com/M-Igashi/mp3rgain/releases/download/${{ github.ref_name }}/mp3rgain-${{ github.ref_name }}-windows-arm64.zip", | |
| "hash": "${{ needs.release.outputs.windows_arm64_sha256 }}" | |
| } | |
| }, | |
| "bin": "mp3rgain.exe", | |
| "checkver": "github", | |
| "autoupdate": { | |
| "architecture": { | |
| "64bit": { | |
| "url": "https://github.com/M-Igashi/mp3rgain/releases/download/v$version/mp3rgain-v$version-windows-x86_64.zip" | |
| }, | |
| "arm64": { | |
| "url": "https://github.com/M-Igashi/mp3rgain/releases/download/v$version/mp3rgain-v$version-windows-arm64.zip" | |
| } | |
| }, | |
| "hash": { | |
| "url": "$url.sha256" | |
| } | |
| } | |
| } | |
| EOF | |
| - name: Commit and push | |
| run: | | |
| cd scoop-bucket | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| git add mp3rgain.json | |
| git commit -m "Update mp3rgain to ${{ needs.release.outputs.version }}" || exit 0 | |
| git push | |
| # Update Homebrew tap | |
| update-homebrew: | |
| name: Update Homebrew Tap | |
| needs: release | |
| runs-on: ubuntu-latest | |
| continue-on-error: true | |
| steps: | |
| - name: Checkout homebrew-tap | |
| uses: actions/checkout@v4 | |
| with: | |
| repository: M-Igashi/homebrew-tap | |
| token: ${{ secrets.HOMEBREW_TAP_TOKEN }} | |
| path: homebrew-tap | |
| - name: Update formula | |
| run: | | |
| cd homebrew-tap/Formula | |
| sed -i 's|url "https://github.com/M-Igashi/mp3rgain/releases/download/v[^"]*|url "https://github.com/M-Igashi/mp3rgain/releases/download/${{ github.ref_name }}/mp3rgain-${{ github.ref_name }}-macos-universal.tar.gz|' mp3rgain.rb | |
| sed -i 's|sha256 "[^"]*"|sha256 "${{ needs.release.outputs.macos_sha256 }}"|' mp3rgain.rb | |
| sed -i 's|version "[^"]*"|version "${{ needs.release.outputs.version }}"|' mp3rgain.rb | |
| - name: Commit and push | |
| run: | | |
| cd homebrew-tap | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| git add Formula/mp3rgain.rb | |
| git commit -m "Update mp3rgain to ${{ needs.release.outputs.version }}" || exit 0 | |
| git push | |
| # Build Debian package | |
| build-deb: | |
| name: Build Debian Package | |
| needs: release | |
| runs-on: ubuntu-latest | |
| continue-on-error: true | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y build-essential debhelper | |
| - name: Install Rust | |
| uses: dtolnay/rust-toolchain@4be9e76fd7c4901c61fb841f559994984270fce7 # stable | |
| - name: Setup debian directory | |
| run: cp -r packages/debian/debian . | |
| - name: Update changelog version | |
| run: | | |
| VERSION=${{ needs.release.outputs.version }} | |
| DATE=$(date -R) | |
| cat > debian/changelog << EOF | |
| mp3rgain (${VERSION}-1) unstable; urgency=medium | |
| * Release ${VERSION} | |
| -- Masanari Higashi <M-Igashi@users.noreply.github.com> ${DATE} | |
| EOF | |
| - name: Build package | |
| run: dpkg-buildpackage -us -uc -b | |
| - name: Upload to release | |
| uses: softprops/action-gh-release@c95fe1489396fe8a9eb87c0abf8aa5b2ef267fda # v2 | |
| with: | |
| files: ../mp3rgain_${{ needs.release.outputs.version }}-1_amd64.deb | |
| # Publish to crates.io | |
| publish-cargo: | |
| name: Publish to crates.io | |
| needs: release | |
| runs-on: ubuntu-latest | |
| continue-on-error: true | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install Rust | |
| uses: dtolnay/rust-toolchain@4be9e76fd7c4901c61fb841f559994984270fce7 # stable | |
| - name: Publish to crates.io | |
| run: cargo publish --token ${{ secrets.CARGO_REGISTRY_TOKEN }} | |
| env: | |
| CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }} |