3030 - uses : actions/checkout@v4
3131
3232 - name : Install Rust
33- uses : dtolnay/rust-toolchain@4be9e76fd7c4901c61fb841f559994984270fce7 # stable
33+ uses : dtolnay/rust-toolchain@4be9e76fd7c4901c61fb841f559994984270fce7 # stable
3434 with :
3535 targets : ${{ matrix.target }}
3636
5555 name : Create Release
5656 needs : build
5757 runs-on : macos-latest
58+ outputs :
59+ version : ${{ steps.version.outputs.version }}
60+ windows_x64_sha256 : ${{ steps.checksums.outputs.windows_x64_sha256 }}
61+ windows_arm64_sha256 : ${{ steps.checksums.outputs.windows_arm64_sha256 }}
62+ macos_sha256 : ${{ steps.checksums.outputs.macos_sha256 }}
5863 steps :
5964 - uses : actions/checkout@v4
6065
66+ - name : Get version
67+ id : version
68+ run : echo "version=${GITHUB_REF_NAME#v}" >> $GITHUB_OUTPUT
69+
6170 - name : Download all artifacts
6271 uses : actions/download-artifact@v4
6372 with :
@@ -100,8 +109,15 @@ jobs:
100109 cd ../../dist
101110 shasum -a 256 mp3rgain-${{ github.ref_name }}-windows-arm64.zip > mp3rgain-${{ github.ref_name }}-windows-arm64.zip.sha256
102111
112+ - name : Extract checksums
113+ id : checksums
114+ run : |
115+ echo "windows_x64_sha256=$(cat dist/mp3rgain-${{ github.ref_name }}-windows-x86_64.zip.sha256 | awk '{print $1}')" >> $GITHUB_OUTPUT
116+ echo "windows_arm64_sha256=$(cat dist/mp3rgain-${{ github.ref_name }}-windows-arm64.zip.sha256 | awk '{print $1}')" >> $GITHUB_OUTPUT
117+ echo "macos_sha256=$(cat dist/mp3rgain-${{ github.ref_name }}-macos-universal.tar.gz.sha256 | awk '{print $1}')" >> $GITHUB_OUTPUT
118+
103119 - name : Create Release
104- uses : softprops/action-gh-release@26994186c0ac3ef5cae75ac16aa32e8153525f77 # v1
120+ uses : softprops/action-gh-release@c95fe1489396fe8a9eb87c0abf8aa5b2ef267fda # v2
105121 with :
106122 files : |
107123 dist/mp3rgain-${{ github.ref_name }}-macos-universal.tar.gz
@@ -112,4 +128,109 @@ jobs:
112128 dist/mp3rgain-${{ github.ref_name }}-windows-x86_64.zip.sha256
113129 dist/mp3rgain-${{ github.ref_name }}-windows-arm64.zip
114130 dist/mp3rgain-${{ github.ref_name }}-windows-arm64.zip.sha256
115- generate_release_notes : true
131+ draft : true
132+ generate_release_notes : false
133+
134+ # Update Scoop bucket
135+ update-scoop :
136+ name : Update Scoop Bucket
137+ needs : release
138+ runs-on : ubuntu-latest
139+ steps :
140+ - name : Checkout scoop-bucket
141+ uses : actions/checkout@v4
142+ with :
143+ repository : M-Igashi/scoop-bucket
144+ token : ${{ secrets.SCOOP_BUCKET_TOKEN }}
145+ path : scoop-bucket
146+
147+ - name : Update manifest
148+ run : |
149+ cd scoop-bucket
150+ cat > mp3rgain.json << 'EOF'
151+ {
152+ "version": "${{ needs.release.outputs.version }}",
153+ "description": "Lossless MP3 volume adjustment - a modern mp3gain replacement written in Rust",
154+ "homepage": "https://github.com/M-Igashi/mp3rgain",
155+ "license": "MIT",
156+ "architecture": {
157+ "64bit": {
158+ "url": "https://github.com/M-Igashi/mp3rgain/releases/download/${{ github.ref_name }}/mp3rgain-${{ github.ref_name }}-windows-x86_64.zip",
159+ "hash": "${{ needs.release.outputs.windows_x64_sha256 }}"
160+ },
161+ "arm64": {
162+ "url": "https://github.com/M-Igashi/mp3rgain/releases/download/${{ github.ref_name }}/mp3rgain-${{ github.ref_name }}-windows-arm64.zip",
163+ "hash": "${{ needs.release.outputs.windows_arm64_sha256 }}"
164+ }
165+ },
166+ "bin": "mp3rgain.exe",
167+ "checkver": "github",
168+ "autoupdate": {
169+ "architecture": {
170+ "64bit": {
171+ "url": "https://github.com/M-Igashi/mp3rgain/releases/download/v$version/mp3rgain-v$version-windows-x86_64.zip"
172+ },
173+ "arm64": {
174+ "url": "https://github.com/M-Igashi/mp3rgain/releases/download/v$version/mp3rgain-v$version-windows-arm64.zip"
175+ }
176+ },
177+ "hash": {
178+ "url": "$url.sha256"
179+ }
180+ }
181+ }
182+ EOF
183+
184+ - name : Commit and push
185+ run : |
186+ cd scoop-bucket
187+ git config user.name "github-actions[bot]"
188+ git config user.email "github-actions[bot]@users.noreply.github.com"
189+ git add mp3rgain.json
190+ git commit -m "Update mp3rgain to ${{ needs.release.outputs.version }}" || exit 0
191+ git push
192+
193+ # Update Homebrew tap
194+ update-homebrew :
195+ name : Update Homebrew Tap
196+ needs : release
197+ runs-on : ubuntu-latest
198+ steps :
199+ - name : Checkout homebrew-tap
200+ uses : actions/checkout@v4
201+ with :
202+ repository : M-Igashi/homebrew-tap
203+ token : ${{ secrets.HOMEBREW_TAP_TOKEN }}
204+ path : homebrew-tap
205+
206+ - name : Update formula
207+ run : |
208+ cd homebrew-tap/Formula
209+ 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
210+ sed -i 's|sha256 "[^"]*"|sha256 "${{ needs.release.outputs.macos_sha256 }}"|' mp3rgain.rb
211+ sed -i 's|version "[^"]*"|version "${{ needs.release.outputs.version }}"|' mp3rgain.rb
212+
213+ - name : Commit and push
214+ run : |
215+ cd homebrew-tap
216+ git config user.name "github-actions[bot]"
217+ git config user.email "github-actions[bot]@users.noreply.github.com"
218+ git add Formula/mp3rgain.rb
219+ git commit -m "Update mp3rgain to ${{ needs.release.outputs.version }}" || exit 0
220+ git push
221+
222+ # Publish to crates.io
223+ publish-cargo :
224+ name : Publish to crates.io
225+ needs : release
226+ runs-on : ubuntu-latest
227+ steps :
228+ - uses : actions/checkout@v4
229+
230+ - name : Install Rust
231+ uses : dtolnay/rust-toolchain@4be9e76fd7c4901c61fb841f559994984270fce7 # stable
232+
233+ - name : Publish to crates.io
234+ run : cargo publish --token ${{ secrets.CARGO_REGISTRY_TOKEN }}
235+ env :
236+ CARGO_REGISTRY_TOKEN : ${{ secrets.CARGO_REGISTRY_TOKEN }}
0 commit comments