Skip to content

Commit

Permalink
feat (Github): adds docs and build yml
Browse files Browse the repository at this point in the history
  • Loading branch information
jamiepollock committed Jun 3, 2024
1 parent 2b114a0 commit 4ff9c3b
Show file tree
Hide file tree
Showing 6 changed files with 210 additions and 0 deletions.
30 changes: 30 additions & 0 deletions .github/BUILD.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Running a local build

The following is a powershell script which will create a local packages.

You will need to setup your IDE to support a local NuGet feed or include these packages in the project some other way.

> [!TIP]
> Generally it is a good idea to set the NuGet package version to have a `-beta{number}` or `-alpha{number}` suffix so as not to get a conflict with released versions on a remote NuGet feed.
```powershell
# This script is intended to be placed and run outside of the git repo so it is not accidentally committed.
# To run this script you will need dotnet-cli (v6) installed
$CONFIG = 'Release';
$IN_FOLDER = 'C:\Path\To\Rhythm.IO\Repo\Root'
$OUT_FOLDER = 'C:\Path\To\Your\Local\nuget';
# NuGet package version (e.g. 1.0.1-beta1)
$VERSION = '1.0.0';
$START_FOLDER = (get-location).path;
Set-Location $IN_FOLDER;
# Restore dependencies
dotnet restore ./src/Rhythm.IO.sln
# Build Rhythm.IO
dotnet pack ./src/Rhythm.IO/Rhythm.IO.csproj --no-restore -c ${CONFIG} --output ${OUT_FOLDER} /p:version=${VERSION}
Set-Location $START_FOLDER;
```
11 changes: 11 additions & 0 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# How to contribute to Rhythm.IO

Thanks for reading this guide on how to contribute!

## For maintainers

If you are a maintainer looking to create a new release or other actions check out the [maintainers guide](contributing-maintainers.md).

## For contributors

If you are a contributor looking to submit an issue or feature request check out the [contributors guide](contributing-contributors.md).
27 changes: 27 additions & 0 deletions .github/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# rhythm.io [![Publish to NuGet](https://github.com/rhythmagency/rhythm.io/actions/workflows/Publish-to-NuGet.yml/badge.svg)](https://github.com/rhythmagency/rhythm.io/actions/workflows/Publish-to-NuGet.yml) [![NuGet](https://img.shields.io/nuget/v/Rhythm.IO?logo=nuget)](https://www.nuget.org/packages/Rhythm.IO)
A .net library for common input/output tasks.

## Startup

To get started with Rhythm IO you will be the following;

- .net 6+ web project
- Install the Rhythm.IO NuGet package

Once installed add the following to your Program.cs during the `WebApplicationBuilder` before `Build()` is called.

```csharp
builder.AddRhythmIO();
```

Alternatively if you are using Startup.cs `ConfigureServices(IServiceCollection services)` add the following:

```csharp
public void ConfigureServices(IServiceCollection services) {
services.AddRhythmIO();
}
```

# Contributing

If you would like to contibute please check our [contributing guide](CONTRIBUTING.md)!
32 changes: 32 additions & 0 deletions .github/contributing-contributors.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Contributors guide to Rhythm.IO

If you are a maintainer look for information how create new releases or other maintainer task check out the [maintainers guide](contributing-maintainers.md).

Thanks for reading this guide on how to contribute!

## Found an issue?

Create an issue outlining;

* What you've found
* The version it's in
* Steps to replicate
* Any additional resources like images, videos which might support

> [!TIP]
> Please note: this is issue tracker and not a support forum. Be sure to check the readme or wiki before reach out.
### Want to submit a fix?

After submitting an issue and discussing a potential solution with us there may be an opportunity to submit a fix. We operate on a pull request basis. In order to do this we recommend you take the following steps;

1. Create a fork of the Rhythm.IO repo on your github account
2. Clone the fork locally
3. Begin making a change locally
4. Commit little and often
5. Run [a local build](BUILD.md) and test against a local project before pushing to remote
6. Submit a pull request

## Have a new feature request?

Raise a ticket and we'll review your request. It is always best to discuss new features first rather diving into a PR. This way we can discuss if it's a right fit for Rhythm.IO.
58 changes: 58 additions & 0 deletions .github/contributing-maintainers.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# Maintainers Guide to Rhythm.IO

The following guide is intended to maintainers of this repo. If you're not a maintainer check the [contributors guide](contributing-contributors.md).

## Creating new releases

The following assumes you have tested [a local build](BUILD.md) and merged all changes into the main branch ready for the next release of Rhythm.IO.

> [!Warning]
> Do not proceed if you have not run a local build.
> You must test what you are about to commit will not cause a build failure. Such actions are irreversable!
Great. Now we have that over and done with it. Let's create a new release!

### Step 1: Tagging the release
Create a new tag locally. Tags follow the following format `v{3 part-sematic version number}(-optional NuGet accepted suffix)`. Tags **must** start with the a lower case _v_.

✅Valid examples include;

* v1.0.0-beta1
* v1.0.0

❌ Invalid examples include;

* 1.0.0
* v1
* v1.0
* v1.0.0-

### Step 2: push tag to remote

Once the valid tag has been pushed to remote it will kick off a build action follow this build action and wait for it complete.

This will automatically push a release to NuGet for the tag version. The NuGet version will be the tag name without the _v_ prefix.

### Step 3: create a new release

Now the package is pushed to NuGet we're ready to create a new release in GitHub.

1. Select the new tag
2. Set the title of the release to be the same as the tag. (e.g. v1.0.0)
3. Add release notes letting users generally what has changed in this version
4. If you are creating a release for work by other people be sure to save this release as a draft and has it reviewed by others
5. If this release was supported by other PRs list these PRs in the notes
6. If this is a pre-release build check the pre-release option. This is used for releases with a suffix like beta, alpha or rc)
7. Once complete publish the release

## General release guidelines

### Breaking changes

Consider carefully if the code you are releasing has any breaking changes and whether a new major version should be created. Always document breaking changes in release notes.

### Pre-releases

We generally do not release too many pre-release version. Instead choosing to fix with patch or minor version.

As the maintainers team is small ideally releasing less versions that are more thought out would be the ideal path.
52 changes: 52 additions & 0 deletions .github/workflows/Publish-to-NuGet.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# 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: Publish to NuGet

# on Push tags matching v1.0.0 or v1.0.0-suffix
on:
push:
tags:
[ "v[0-9]+.[0-9]+.[0-9]+", "v[0-9]+.[0-9]+.[0-9]+-[0-9a-z]+" ]

jobs:
build:

env:
SOLUTION: 'src\Rhythm.IO.sln'
BUILD_CONFIG: 'Release'

runs-on: ubuntu-latest

steps:
# Setup
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: 6.0.x

# Remove 'v' prefix from tag to match NuGet version format
- name: Set Package Version
run: |
echo "PACKAGE_VERSION=${GITHUB_REF_NAME/v/}" >> "$GITHUB_ENV"
- name: Display Package Version
run: |
echo "Package Version: $PACKAGE_VERSION"
# Restore
- name: Restore dependencies
run: dotnet restore $SOLUTION

# Start packaging process
- name: Pack Rhythm.IO
run: dotnet pack ./src/Rhythm.IO/Rhythm.IO.csproj --no-restore -c $BUILD_CONFIG /p:version=$PACKAGE_VERSION

- name: Publish Packages to NuGet
run: dotnet nuget push **\*.nupkg --api-key ${{secrets.NUGET_API_KEY}} --source https://api.nuget.org/v3/index.json

0 comments on commit 4ff9c3b

Please sign in to comment.