Release Build #10
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 Build | |
| on: workflow_dispatch | |
| permissions: write-all | |
| env: | |
| CARGO_INCREMENTAL: 0 | |
| RUST_BACKTRACE: short | |
| jobs: | |
| release: | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - os: windows-latest | |
| target: x86_64-pc-windows-msvc | |
| platform: | |
| arch: x64 | |
| - os: windows-latest | |
| target: aarch64-pc-windows-msvc | |
| arch: arm64 | |
| - os: macos-latest | |
| target: aarch64-apple-darwin | |
| arch: arm64 | |
| - os: macos-latest | |
| target: x86_64-apple-darwin | |
| arch: x64 | |
| - os: ubuntu-latest | |
| target: x86_64-unknown-linux-gnu | |
| arch: x64 | |
| - os: ubuntu-latest | |
| target: aarch64-unknown-linux-gnu | |
| arch: arm64 | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - name: Checkout Repository | |
| uses: actions/checkout@v4 | |
| - name: Install Rust Stable | |
| uses: dtolnay/rust-toolchain@stable | |
| - name: Add Rust Target | |
| run: rustup target add ${{ matrix.target }} | |
| - name: Rust Cache | |
| uses: Swatinem/rust-cache@v2 | |
| with: | |
| cache-all-crates: true | |
| - name: Install toml-cli | |
| run: cargo install toml-cli | |
| - name: Get Version (Linux/MacOS) | |
| if: runner.os != 'Windows' | |
| run: | | |
| VERSION=$(toml get Cargo.toml package.version) | |
| VERSION=${VERSION//\"/} | |
| echo "VERSION=$VERSION" >> $GITHUB_ENV | |
| - name: Get Version (Windows) | |
| if: runner.os == 'Windows' | |
| run: | | |
| $version = (toml get Cargo.toml package.version).Trim('"') | |
| echo "VERSION=$version" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append | |
| - name: Install cross | |
| run: cargo install cross | |
| - name: Build Nvmd | |
| run: | | |
| cross build --release --target ${{ matrix.target }} | |
| - name: Rename For Windows | |
| if: matrix.os == 'windows-latest' | |
| run: | | |
| Rename-Item '.\target\${{ matrix.target }}\release\nvmd.exe' 'nvmd_windows-${{ matrix.arch }}.exe' | |
| - name: Rename For MacOS | |
| if: matrix.os == 'macos-latest' | |
| run: | | |
| mv target/${{ matrix.target }}/release/nvmd nvmd_macos-${{ matrix.arch }} | |
| - name: Rename For Linux | |
| if: matrix.os == 'ubuntu-latest' | |
| run: | | |
| mv target/${{ matrix.target }}/release/nvmd nvmd_linux-${{ matrix.arch }} | |
| - name: Upload Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: v${{env.VERSION}} | |
| name: 'NVMD Command v${{env.VERSION}}' | |
| body: 'More new features are now supported.' | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| files: | | |
| target/${{ matrix.target }}/release/nvmd_windows*.exe | |
| nvmd_macos-* | |
| nvmd_linux-* | |
| upload_release: | |
| name: Upload Release | |
| runs-on: ubuntu-latest | |
| needs: [release] | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Install Rust Stable | |
| uses: dtolnay/rust-toolchain@stable | |
| - name: Install toml-cli | |
| run: cargo install toml-cli | |
| - name: Get Version | |
| run: | | |
| VERSION=$(toml get Cargo.toml package.version) | |
| VERSION=${VERSION//\"/} | |
| echo "VERSION=$VERSION" >> $GITHUB_ENV | |
| - name: Upload Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: v${{env.VERSION}} | |
| name: 'NVMD Command v${{env.VERSION}}' | |
| body: 'More new features are now supported.' | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| files: | | |
| template/temp.cmd |