Skip to content

Commit df03e78

Browse files
authored
Add GitHub actions to ZigbeeNet (#160)
* Add GitHub Action for CI * Change push trigger to use all branches * Update to use .NET 3.1 * Update README.md * Force full path to build status badges * Add release action * Rename cd to cd.yml * Update ci.yml * Update cd.yml * Update ci.yml * Add documentation about CICD * Update documentation to include description about secret
1 parent db2aa59 commit df03e78

File tree

4 files changed

+88
-2
lines changed

4 files changed

+88
-2
lines changed

.github/workflows/cd.yml

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: CD
2+
3+
on:
4+
release:
5+
types:
6+
- edited
7+
- released
8+
9+
jobs:
10+
release:
11+
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- uses: actions/checkout@v2
16+
- name: Setup .NET
17+
uses: actions/setup-dotnet@v1
18+
with:
19+
dotnet-version: 3.1.x
20+
21+
- name: Restore dependencies
22+
run: dotnet restore
23+
- name: Build
24+
run: dotnet build --no-restore --configuration Release
25+
- name: Test
26+
run: dotnet test --no-build --configuration Release
27+
28+
- name: Create NuGet packages
29+
run: |
30+
VERSION=$(echo "${{ github.event.release.tag_name }}" | cut -c2-)
31+
echo $VERSION
32+
dotnet pack --no-build --configuration Release -p:Version=$VERSION
33+
- name: Publish NuGet packages
34+
run: dotnet nuget push "**/*.nupkg" --api-key $NUGET_AUTH_TOKEN --source https://api.nuget.org/v3/index.json --skip-duplicate
35+
env:
36+
NUGET_AUTH_TOKEN: ${{ secrets.NUGET_API_KEY }}

.github/workflows/ci.yml

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches:
6+
- '*'
7+
pull_request:
8+
branches:
9+
- develop
10+
- master
11+
12+
jobs:
13+
build:
14+
15+
runs-on: ubuntu-latest
16+
17+
steps:
18+
- uses: actions/checkout@v2
19+
- name: Setup .NET
20+
uses: actions/setup-dotnet@v1
21+
with:
22+
dotnet-version: 3.1.x
23+
24+
- name: Restore dependencies
25+
run: dotnet restore
26+
- name: Build
27+
run: dotnet build --no-restore --configuration Release
28+
- name: Test
29+
run: dotnet test --no-build --configuration Release

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ It is fully implemented in Netstandard 2.0 and NET Core 3.0 so that it runs on m
1111

1212
| Name | Status |
1313
| ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
14-
| 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) |
15-
| 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) |
14+
| 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) |
15+
| 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) |
1616

1717
## Packages ##
1818

docs/cicd.md

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# CI & CD setup
2+
3+
Continuous Integration (CI) and Continuous Delivery (CD)
4+
has been implemented using GitHub Actions.
5+
Content on these files can be found in `.github/workflows/` folder.
6+
7+
CI uses `dotnet` command-line tooling in build steps.
8+
Build is initiated by `push` to branch or `pull request`
9+
to `develop` or `master` branches.
10+
11+
CD also uses `dotnet` tooling. It's initiated by
12+
creating GitHub Release in the repository.
13+
14+
**Important**: CD uses `tag_name` from the release
15+
as it's package version. Meaning if you tag your
16+
release using `v1.5.0`, it will automatically version NuGet
17+
packages as `1.5.0`.
18+
19+
**Important 2**: CD requires `NUGET_API_KEY` names [secret](https://docs.github.com/en/actions/reference/encrypted-secrets)
20+
to be stored into the repository secrets.
21+
It's used when publishing NuGet Packages to the nuget.org.

0 commit comments

Comments
 (0)