Upload artifacts for PRs #72
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 Driver | |
on: | |
workflow_dispatch: | |
push: | |
branches: ["master"] | |
pull_request: | |
branches: ["master"] | |
release: | |
types: [created] | |
env: | |
CARGO_TERM_COLOR: always | |
jobs: | |
build: | |
permissions: write-all | |
runs-on: windows-2022 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Setup Rust toolchain | |
run: rustup toolchain install stable --profile minimal | |
- name: Rust cache | |
uses: Swatinem/rust-cache@v2 | |
with: | |
key: ${{ github.event_name == 'release' && 'prod' || 'dev' }} | |
- name: Install cargo-make | |
uses: baptiste0928/cargo-install@v2 | |
with: | |
crate: cargo-make | |
- name: Export Private Certificate | |
env: | |
PRIVATE_KEY: ${{ secrets.PRIVATE_KEY }} | |
run: | | |
$env:PRIVATE_KEY | Out-File -FilePath private.txt | |
certutil -decode private.txt private.pfx | |
- name: Export Public Certificate | |
run: | | |
Get-PfxCertificate -FilePath private.pfx -Password (ConvertTo-SecureString -String "${{ secrets.PRIVATE_KEY_PASSWORD }}" -AsPlainText -Force) | Export-Certificate -FilePath DriverCertificate.cer -type CERT | |
- name: Build Driver | |
env: | |
PRIVATE_KEY_PASSWORD: ${{ secrets.PRIVATE_KEY_PASSWORD }} | |
RELEASE: ${{ github.event_name == 'release' && 'prod' || 'dev' }} | |
run: cargo make -p $env:RELEASE build | |
- name: Upload Artifacts | |
if: github.event_name != 'release' | |
uses: actions/upload-artifact@v3 | |
with: | |
name: driver | |
path: | | |
target/debug/*.cat | |
target/debug/*.dll | |
target/debug/*.inf | |
DriverCertificate.cer | |
- uses: vimtor/action-zip@v1 | |
if: github.event_name == 'release' | |
with: | |
files: target/release/VirtualDisplayDriver.cat target/release/VirtualDisplayDriver.dll target/release/VirtualDisplayDriver.inf DriverCertificate.cer | |
dest: virtual-desktop-driver-x64.zip | |
- name: Attach assets to release | |
if: github.event_name == 'release' | |
uses: xresloader/upload-to-github-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
file: "*.zip" | |
draft: false | |
release_id: ${{ github.event.release.id }} |