diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..bc74a9b --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,24 @@ +name: Release + +on: + workflow_dispatch: + push: + tags: + - 'v*' + +jobs: + publish: + runs-on: ubuntu-latest + # environment: release # Optional: for enhanced security + permissions: + id-token: write # Required for OIDC token exchange + steps: + - uses: actions/checkout@v4 + - uses: rust-lang/crates-io-auth-action@v1 + if: github.ref_type == 'tag' + id: auth + - uses: katyo/publish-crates@v2 + with: + registry-token: ${{ steps.auth.outputs.token }} + dry-run: ${{ github.ref_type != 'tag' }} + ignore-unpublished-changes: true diff --git a/freertos-rust/src/critical.rs b/freertos-rust/src/critical.rs index 79f8dea..405d711 100644 --- a/freertos-rust/src/critical.rs +++ b/freertos-rust/src/critical.rs @@ -37,7 +37,7 @@ impl ExclusiveData { } } - pub fn lock(&self) -> Result, FreeRtosError> { + pub fn lock(&self) -> Result, FreeRtosError> { Ok(ExclusiveDataGuard { __data: &self.data, __lock: CriticalRegion::enter(), @@ -47,7 +47,7 @@ impl ExclusiveData { pub fn lock_from_isr( &self, _context: &mut crate::isr::InterruptContext, - ) -> Result, FreeRtosError> { + ) -> Result, FreeRtosError> { Ok(ExclusiveDataGuardIsr { __data: &self.data }) } } @@ -106,7 +106,7 @@ impl SuspendScheduler { } } - pub fn lock(&self) -> SuspendSchedulerGuard { + pub fn lock(&self) -> SuspendSchedulerGuard<'_,T> { unsafe { freertos_rs_vTaskSuspendAll(); } diff --git a/freertos-rust/src/mutex.rs b/freertos-rust/src/mutex.rs index fb43eff..6d71542 100644 --- a/freertos-rust/src/mutex.rs +++ b/freertos-rust/src/mutex.rs @@ -36,7 +36,7 @@ where } /// Try to obtain a lock and mutable access to our inner value - pub fn lock(&self, max_wait: D) -> Result, FreeRtosError> { + pub fn lock(&self, max_wait: D) -> Result, FreeRtosError> { self.mutex.take(max_wait)?; Ok(MutexGuard { diff --git a/freertos-rust/src/semaphore.rs b/freertos-rust/src/semaphore.rs index 75ccef6..cb5d476 100644 --- a/freertos-rust/src/semaphore.rs +++ b/freertos-rust/src/semaphore.rs @@ -50,7 +50,7 @@ impl Semaphore { } /// Lock this semaphore in a RAII fashion - pub fn lock(&self, max_wait: D) -> Result { + pub fn lock(&self, max_wait: D) -> Result, FreeRtosError> { self.take(max_wait).map(|()| SemaphoreGuard { owner: self }) }