Skip to content

docs: add Claude rules for winget PR and release workflow #16

docs: add Claude rules for winget PR and release workflow

docs: add Claude rules for winget PR and release workflow #16

Workflow file for this run

name: Release

Check failure on line 1 in .github/workflows/release.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/release.yml

Invalid workflow file

(Line: 141, Col: 9): Unrecognized named-value: 'secrets'. Located at position 1 within expression: secrets.SCOOP_BUCKET_TOKEN != ''
on:
push:
tags:
- "v*"
permissions:
contents: write
jobs:
build:
name: Build 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
release:
name: Create Release
needs: build
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: 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
draft: true
generate_release_notes: false
# Update Scoop bucket
update-scoop:
name: Update Scoop Bucket
needs: release
runs-on: ubuntu-latest
if: ${{ secrets.SCOOP_BUCKET_TOKEN != '' }}
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
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
# Publish to crates.io
publish-cargo:
name: Publish to crates.io
needs: release
runs-on: ubuntu-latest
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 }}