Linux build with the tested Rust version #11
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: Build and release | |
on: | |
push: | |
branches: | |
- master | |
tags: | |
- v* | |
jobs: | |
build-linux: | |
runs-on: ubuntu-22.04 # https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#choosing-github-hosted-runners | |
container: rust:1.72.1 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4.1.0 # https://github.com/actions/checkout/releases | |
with: | |
persist-credentials: false | |
- name: Build | |
run: cargo build --release -vv | |
- name: Archive | |
run: tar -cf- -C target/release musbconv | xz -c9e - > musbconv-linux.tar.xz | |
- name: Save | |
uses: actions/upload-artifact@v3.1.3 # https://github.com/actions/upload-artifact/releases | |
with: | |
name: release-linux | |
path: "*.tar.xz" | |
build-windows: | |
runs-on: windows-2022 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4.1.0 | |
with: | |
persist-credentials: false | |
- name: Build | |
run: cargo build --release -vv | |
- name: Archive | |
run: Compress-Archive -Path target\release\musbconv.exe -DestinationPath musbconv-windows.zip | |
- name: Save | |
uses: actions/upload-artifact@v3.1.3 | |
with: | |
name: release-windows | |
path: "*.zip" | |
build-macos: | |
runs-on: macos-12 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4.1.0 | |
with: | |
persist-credentials: false | |
- name: Build | |
run: cargo build --release -vv | |
- name: Archive | |
run: tar -cf- -C target/release musbconv | xz -c9e - > musbconv-macos.tar.xz | |
- name: Save | |
uses: actions/upload-artifact@v3.1.3 | |
with: | |
name: release-macos | |
path: "*.tar.xz" | |
release: | |
if: startsWith(github.ref, 'refs/tags/') | |
needs: | |
- build-linux | |
- build-windows | |
- build-macos | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Version | |
id: version | |
run: echo ::set-output name=version::${GITHUB_REF#refs/tags/} | |
- name: Checkout | |
uses: actions/checkout@v4.1.0 | |
with: | |
persist-credentials: false | |
- name: Notes | |
run: grep -Pzom1 "(?s)\n[##\s]*${{ steps.version.outputs.version }}.*?\n+.*?\K.*?(\n\n|$)" CHANGELOG.md | sed 's/[^[:print:]]//g' > RELEASE.md | |
- name: Download | |
uses: actions/download-artifact@v3.0.2 # https://github.com/actions/download-artifact/releases | |
with: | |
path: artifacts | |
- name: Rename | |
run: | | |
mv artifacts/release-linux/musbconv-linux.tar.xz artifacts/release-linux/musbconv-linux-${{ steps.version.outputs.version }}.tar.xz | |
mv artifacts/release-windows/musbconv-windows.zip artifacts/release-windows/musbconv-windows-${{ steps.version.outputs.version }}.zip | |
mv artifacts/release-macos/musbconv-macos.tar.xz artifacts/release-macos/musbconv-macos-${{ steps.version.outputs.version }}.tar.xz | |
- name: Release | |
uses: softprops/action-gh-release@v0.1.15 # https://github.com/softprops/action-gh-release/releases | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
files: | | |
artifacts/release-linux/*.tar.xz | |
artifacts/release-windows/*.zip | |
artifacts/release-macos/*.tar.xz | |
body_path: RELEASE.md |