Skip to content

chore: Update Rust workflow to use actions-rs/toolchain@v2 for settin… #6

chore: Update Rust workflow to use actions-rs/toolchain@v2 for settin…

chore: Update Rust workflow to use actions-rs/toolchain@v2 for settin… #6

Workflow file for this run

name: Rust
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
env:
CARGO_TERM_COLOR: always
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
steps:
- uses: actions/checkout@v4
- name: Set up Rust stable
uses: actions-rs/toolchain@v2
with:
profile: minimal
toolchain: stable
- name: Build
run: cargo build --release --verbose
- name: Run tests
run: cargo test --release --verbose
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.os == 'windows-latest' && 'ml2pdf-windows' || 'ml2pdf-linux' }}
path: ${{ matrix.os == 'windows-latest' && 'target/release/ml2pdf.exe' || 'target/release/ml2pdf' }}
release:
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/checkout@v4
- name: Download Windows artifact
uses: actions/download-artifact@v3
with:
name: ml2pdf-windows
path: ./artifacts
- name: Download Linux artifact
uses: actions/download-artifact@v3
with:
name: ml2pdf-linux
path: ./artifacts
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: v${{ github.run_number }}
release_name: Release ${{ github.run_number }}
draft: false
prerelease: false
- name: Upload Windows Release Asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./artifacts/ml2pdf-windows/ml2pdf.exe
asset_name: ml2pdf.exe
asset_content_type: application/octet-stream
- name: Upload Linux Release Asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./artifacts/ml2pdf-linux/ml2pdf
asset_name: ml2pdf
asset_content_type: application/octet-stream