Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
IeuanWalker committed Dec 8, 2023
2 parents fc5b988 + be3cf24 commit 6cf8ceb
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 6 deletions.
35 changes: 35 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# This workflow will build a .NET project
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net

name: Release

on:
release:
types: [published]

env:
NET_VERSION: 8.0.100
NUGET_PATH: './**/IeuanWalker.Hangfire.RecurringJob.${{ github.event.release.tag_name }}.nupkg'
PROJECT_PATH: 'Scr/IeuanWalker.Hangfire.RecurringJob.Generator/IeuanWalker.Hangfire.RecurringJob.Generator.csproj'

jobs:
build:
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
- name: Setup .NET ${{ env.NET_VERSION }}
uses: actions/setup-dotnet@v2
with:
dotnet-version: ${{ env.NET_VERSION }}
- name: Restore dependencies
run: dotnet restore
- name: Build
run: dotnet build ${{ env.PROJECT_PATH }} -c Release /p:Version=${{ github.event.release.tag_name }} --no-restore
- uses: actions/upload-artifact@v3
with:
name: NuGet
path: ${{ env.NUGET_PATH }}
- name: Setup NuGet
uses: NuGet/[email protected]
- name: Publish
run: nuget push **\*.nupkg -Source 'https://api.nuget.org/v3/index.json' -ApiKey ${{secrets.NUGET_API_KEY}}
14 changes: 8 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
# Hangfire.RecurringJob
# Hangfire.RecurringJob [![Nuget](https://img.shields.io/nuget/v/IeuanWalker.Hangfire.RecurringJob)](https://www.nuget.org/packages/IeuanWalker.Hangfire.RecurringJob) [![Nuget](https://img.shields.io/nuget/dt/IeuanWalker.Hangfire.RecurringJob)](https://www.nuget.org/packages/IeuanWalker.Hangfire.RecurringJob)

[![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](https://opensource.org/licenses/MIT)
[![Build](https://github.com/IeuanWalker/Hangfire.RecurringJob/actions/workflows/build.yml/badge.svg)](https://github.com/IeuanWalker/Hangfire.RecurringJob/actions/workflows/build.yml)

This is a package that automatically generates the hanfire recurring jobs `AddOrUpdate` code, using source generators.
Automatically generates the recurring job registration code using source generators

## How to use it?
1. Install the [NuGet package](#) into your project.
```
Install-Package IeuanWalker.Hangfire.RecurringJob
```

2. Add the `RecurringJob` attribute to a class, and create a `Execute()` method.
2. Add the `RecurringJob` attribute to a class, and create an `Execute()` method.
```csharp
[RecurringJob]
public class RecurringJob1
Expand Down Expand Up @@ -49,15 +51,15 @@ public class RecurringJob4
}
```
3. Register the recurring jobs
> Once a `RecurringJob` attribute has been added to a class in your project a exention method for `IApplicationBuilder` will automatically be created.
> The extention method name convention is AddRecurringJobsFrom + your assebly name.
> Once a `RecurringJob` attribute has been added to a class in your project an extension method for `IApplicationBuilder` will automatically be created.
> The extension method name convention is AddRecurringJobsFrom + your assembly name.
```csharp
app.AddRecurringJobsFromExampleProject();
```

## Example
Here is an example of what it looks like in use -
> Left is example code, right is the generated code
> Left is the example code, and right is the generated code
![image](https://github.com/IeuanWalker/Hangfire.RecurringJob.Generator/assets/6544051/cef12771-5178-46cf-9264-dbb54654efc6)

Expand Down

0 comments on commit 6cf8ceb

Please sign in to comment.