Skip to content

stop using nvml-wrapper-sys removing unsafe methods #26

stop using nvml-wrapper-sys removing unsafe methods

stop using nvml-wrapper-sys removing unsafe methods #26

Workflow file for this run

name: Release Workflow
permissions:
contents: write
actions: write
on:
push:
branches:
- master
paths:
- "Cargo.toml"
workflow_dispatch:
jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-tags: true
- name: Set up Rust
uses: actions-rust-lang/setup-rust-toolchain@v1
- name: Get the version from Cargo.toml
id: cargo-version
run: |
VERSION=$(grep '^version' Cargo.toml | sed -E 's/version = "(.*)"/\1/')
echo "VERSION=$VERSION" >> $GITHUB_ENV
- name: Get the latest tag
id: latest-tag
run: |
TAG=$(git describe --tags --abbrev=0 || echo "0.0.0")
echo "TAG=$TAG" >> $GITHUB_ENV
- name: Compare versions
id: compare-versions
run: |
should_release=false
if [ "$(printf '%s\n' "$TAG" "$VERSION" | sort -V | head -n1)" != "$VERSION" ]; then
should_release=true
fi
echo "should_release=$should_release" >> $GITHUB_ENV
env:
TAG: ${{ env.TAG }}
VERSION: ${{ env.VERSION }}
- name: Build the crate
if: env.should_release == 'true'
run: cargo build --release
- name: Create a new tag
if: env.should_release == 'true'
run: |
git tag ${{ env.VERSION }}
git push origin ${{ env.VERSION }}
- name: Create GitHub Release
if: env.should_release == 'true'
uses: softprops/action-gh-release@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ env.VERSION }}
name: ${{ env.VERSION }}
files: target/release/nvidia_oc
- name: Publish to crates.io
if: env.should_release == 'true'
run: cargo publish --token ${{ secrets.CARGO_REGISTRY_TOKEN }}