Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add GitHub actions to ZigbeeNet #160

Merged
merged 12 commits into from
Aug 23, 2021
36 changes: 36 additions & 0 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: CD

on:
release:
types:
- edited
- released

jobs:
release:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Setup .NET
uses: actions/setup-dotnet@v1
with:
dotnet-version: 3.1.x

- name: Restore dependencies
run: dotnet restore
- name: Build
run: dotnet build --no-restore --configuration Release
- name: Test
run: dotnet test --no-build --configuration Release

- name: Create NuGet packages
run: |
VERSION=$(echo "${{ github.event.release.tag_name }}" | cut -c2-)
echo $VERSION
dotnet pack --no-build --configuration Release -p:Version=$VERSION
- name: Publish NuGet packages
run: dotnet nuget push "**/*.nupkg" --api-key $NUGET_AUTH_TOKEN --source https://api.nuget.org/v3/index.json --skip-duplicate
env:
NUGET_AUTH_TOKEN: ${{ secrets.NUGET_API_KEY }}
29 changes: 29 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: CI

on:
push:
branches:
- '*'
pull_request:
branches:
- develop
- master

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Setup .NET
uses: actions/setup-dotnet@v1
with:
dotnet-version: 3.1.x

- name: Restore dependencies
run: dotnet restore
- name: Build
run: dotnet build --no-restore --configuration Release
- name: Test
run: dotnet test --no-build --configuration Release
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ It is fully implemented in Netstandard 2.0 and NET Core 3.0 so that it runs on m

| Name | Status |
| ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| master | [![Build status](https://ci.appveyor.com/api/projects/status/2c0c15ta3ow8pfib/branch/master?svg=true)](https://ci.appveyor.com/project/Mr-Markus/zigbeenet/branch/master) |
| develop | [![Build status](https://ci.appveyor.com/api/projects/status/2c0c15ta3ow8pfib/branch/develop?svg=true)](https://ci.appveyor.com/project/Mr-Markus/zigbeenet/branch/develop) |
| master | [![Build status](https://github.com/Mr-Markus/ZigbeeNet/actions/workflows/ci.yml/badge.svg?branch=master)](https://github.com/Mr-Markus/ZigbeeNet/actions/workflows/ci.yml) |
| develop | [![Build status](https://github.com/Mr-Markus/ZigbeeNet/actions/workflows/ci.yml/badge.svg?branch=develop)](https://github.com/Mr-Markus/ZigbeeNet/actions/workflows/ci.yml) |

## Packages ##

Expand Down
21 changes: 21 additions & 0 deletions docs/cicd.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# CI & CD setup

Continuous Integration (CI) and Continuous Delivery (CD)
has been implemented using GitHub Actions.
Content on these files can be found in `.github/workflows/` folder.

CI uses `dotnet` command-line tooling in build steps.
Build is initiated by `push` to branch or `pull request`
to `develop` or `master` branches.

CD also uses `dotnet` tooling. It's initiated by
creating GitHub Release in the repository.

**Important**: CD uses `tag_name` from the release
as it's package version. Meaning if you tag your
release using `v1.5.0`, it will automatically version NuGet
packages as `1.5.0`.

**Important 2**: CD requires `NUGET_API_KEY` names [secret](https://docs.github.com/en/actions/reference/encrypted-secrets)
to be stored into the repository secrets.
It's used when publishing NuGet Packages to the nuget.org.