Skip to content

Commit

Permalink
Create rust.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
mm9942 authored Jan 22, 2024
1 parent 94a5562 commit 0a5f460
Showing 1 changed file with 52 additions and 0 deletions.
52 changes: 52 additions & 0 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
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, macos-latest, windows-latest]

steps:
- uses: actions/checkout@v3

- name: Build
run: cargo build --verbose --release

- name: Run tests
run: cargo test --verbose

- name: Rename binary for Windows
if: matrix.os == 'windows-latest'
run: mv ./target/release/crypt_guard ./target/release/crypt_guard.exe

- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
MY_GITHUB_PAT: ${{ secrets.MY_GITHUB_PAT }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: false
prerelease: false

- name: Upload Release Asset
uses: actions/upload-release-asset@v1
env:
MY_GITHUB_PAT: ${{ secrets.MY_GITHUB_PAT }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./target/release/crypt_guard${{ matrix.os == 'windows-latest' && '.exe' || '' }}
asset_name: crypt_guard-${{ matrix.os }}${{ matrix.os == 'windows-latest' && '.exe' || '' }}
asset_content_type: application/octet-stream

0 comments on commit 0a5f460

Please sign in to comment.