Generaptor 1.0.0
See the version list below for details.
dotnet add package Generaptor --version 1.0.0
NuGet\Install-Package Generaptor -Version 1.0.0
<PackageReference Include="Generaptor" Version="1.0.0" />
paket add Generaptor --version 1.0.0
#r "nuget: Generaptor, 1.0.0"
// Install Generaptor as a Cake Addin #addin nuget:?package=Generaptor&version=1.0.0 // Install Generaptor as a Cake Tool #tool nuget:?package=Generaptor&version=1.0.0
🦖 Generaptor
Generaptor helps you to maintain GitHub actions for your project. It can generate the YAML files, according to the specification defined in your code.
Now you can manage your action definitions via NuGet packages, and port the whole workflows between repositories. A bit of strong typing will also help to avoid mistakes!
Showcase
Consider this F# program (this is actually used in this very repository):
let mainBranch = "main"
let images = [
"macos-12"
"ubuntu-22.04"
"windows-2022"
]
let workflows = [
workflow "main" [
name "Main"
onPushTo mainBranch
onPullRequestTo mainBranch
onSchedule(day = DayOfWeek.Saturday)
onWorkflowDispatch
job "main" [
checkout
yield! dotNetBuildAndTest()
] |> addMatrix images
]
]
[<EntryPoint>]
let main(args: string[]): int =
EntryPoint.Process args workflows
(See the actual example with all the imports in the main program file.)
It will generate the following GitHub action configuration:
name: Main
on:
push:
branches:
- main
pull_request:
branches:
- main
schedule:
- cron: 0 0 * * 6
workflow_dispatch:
jobs:
main:
strategy:
matrix:
image:
- macos-12
- ubuntu-22.04
- windows-2022
fail-fast: false
runs-on: ${{ matrix.image }}
env:
DOTNET_CLI_TELEMETRY_OPTOUT: 1
DOTNET_NOLOGO: 1
NUGET_PACKAGES: ${{ github.workspace }}/.github/nuget-packages
steps:
- uses: actions/checkout@v4
- name: Set up .NET SDK
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
- name: NuGet cache
uses: actions/cache@v4
with:
key: ${{ runner.os }}.nuget.${{ hashFiles('**/*.fsproj') }}
path: ${{ env.NUGET_PACKAGES }}
- name: Build
run: dotnet build
- name: Test
run: dotnet test
timeout-minutes: 10
How to Use
Create a new F# project in your solution. The location doesn't matter, but we recommend calling it
GitHubActions
and put inside theInfrastructure
solution folder, to not mix it with the main code.Install the
Generaptor.Library
NuGet package.Call the
Generaptor.EntryPoint.Process
method with the arguments passed to themain
function and the list of workflows you want to generate.Run the program from the repository root folder in your shell, for example:
$ cd <your-repository-root-folder> $ dotnet run --project ./Infrastructure/GitHubActions
When called with empty arguments of with command
generate
, it will (re-)generate the workflow files in.github/workflows
folder, relatively to the current directory.
For basic GitHub Action support (workflow and step DSL), see the GitHubActions.fs
file. The basic actions are in the main Generaptor package.
For advanced patterns and action commands ready for use, see Actions and Patterns files. These are in the auxiliary Generaptor.Library package.
Feel free to create your own actions and patterns, and either send a PR to this repository, or publish your own NuGet packages!
Documentation
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
-
net8.0
- FSharp.Core (>= 8.0.101)
- YamlDotNet (>= 15.1.1)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on Generaptor:
Package | Downloads |
---|---|
Generaptor.Library
Package Description |
GitHub repositories
This package is not used by any popular GitHub repositories.