Skip to content

Commit

Permalink
Moving to github build system
Browse files Browse the repository at this point in the history
  • Loading branch information
i8beef committed Oct 23, 2021
1 parent c662a7b commit 2ac21fc
Show file tree
Hide file tree
Showing 4 changed files with 150 additions and 38 deletions.
47 changes: 47 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: build
on:
push:
branches:
- "**"
pull_request:
branches:
- "**"

env:
DOTNETVERSION: "5.0.x"
APP: "HomeAutio.Mqtt.Core"
SOLUTION: "./src/HomeAutio.Mqtt.Core.sln"
BUILDOUTPUTPATH: "./src/HomeAutio.Mqtt.Core/bin/Release/netstandard2.0"

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Setup .NET Core SDK ${{ env.DOTNETVERSION }}
uses: actions/[email protected]
with:
dotnet-version: ${{ env.DOTNETVERSION }}

- name: Install dependencies
run: dotnet restore ${{ env.SOLUTION }}

- name: Build
run: dotnet build ${{ env.SOLUTION }} --configuration Release --no-restore

- name: Upload app build artifact
uses: actions/upload-artifact@v2
with:
name: ${{ env.APP }}
path: ${{ env.BUILDOUTPUTPATH }}

- name: Test
run: dotnet test ${{ env.SOLUTION }} --no-restore --verbosity normal --logger trx --results-directory "TestResults"

- name: Upload TestResults build artifact
uses: actions/upload-artifact@v2
with:
name: TestResults
path: TestResults
101 changes: 101 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
name: release
on:
push:
tags:
- "v[0-9]+.[0-9]+.[0-9]+.[0-9]+"

env:
DOTNETVERSION: "5.0.x"
APP: "HomeAutio.Mqtt.Core"
SOLUTION: "./src/HomeAutio.Mqtt.Core.sln"
BUILDOUTPUTPATH: "./src/HomeAutio.Mqtt.Core/bin/Release/netstandard2.0"
PACKOUTPUTPATH: "./out"

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
with:
ref: master
fetch-depth: 0

- name: Setup .NET Core SDK ${{ env.DOTNETVERSION }}
uses: actions/[email protected]
with:
dotnet-version: ${{ env.DOTNETVERSION }}

- name: Get version
id: version
uses: battila7/get-version-action@v2

- name: Get previous release tag
id: previousTag
uses: sammcoe/[email protected]

- name: Install dependencies
run: dotnet restore ${{ env.SOLUTION }}

- name: Build
run: dotnet build ${{ env.SOLUTION }} --configuration Release --no-restore /p:Version=${{ steps.version.outputs.version-without-v }}

- name: Test
run: dotnet test ${{ env.SOLUTION }} --no-restore --verbosity normal --logger trx --results-directory "TestResults"

- name: Upload app build artifact
uses: actions/upload-artifact@v2
with:
name: ${{ env.APP }}-${{ steps.version.outputs.version-without-v }}
path: ${{ env.BUILDOUTPUTPATH }}

- name: Upload TestResults build artifact
uses: actions/upload-artifact@v2
with:
name: TestResults
path: TestResults

- name: Build changelog
id: gitLog
uses: jarrodparkes/[email protected]
with:
start: ${{ steps.previousTag.outputs.tag }}
end: ${{ github.ref }}

- name: GitHub release
uses: actions/create-release@v1
id: release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
release_name: ${{ steps.version.outputs.version-without-v }}
tag_name: ${{ github.ref }}
body: ${{ env.LOG }}
draft: false
prerelease: false

- name: ZIP release artifact
run: zip -r ${{ env.APP }}-${{ steps.version.outputs.version-without-v }}.zip ${{ env.BUILDOUTPUTPATH }}

- name: GitHub release assets
uses: actions/upload-release-asset@v1
id: release_assets
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.release.outputs.upload_url }}
asset_path: ${{ env.APP }}-${{ steps.version.outputs.version-without-v }}.zip
asset_name: ${{ env.APP }}-${{ steps.version.outputs.version-without-v }}.zip
asset_content_type: application/zip

- name: NuGet pack
run: dotnet pack ${{ env.SOLUTION }} --configuration Release --no-restore --include-symbols /p:Version=${{ steps.version.outputs.version-without-v }} -o ${{ env.PACKOUTPUTPATH }}

- name: Upload NuGet build artifact
uses: actions/upload-artifact@v2
with:
name: ${{ env.APP }} NuGet Packages
path: ${{ env.PACKOUTPUTPATH }}

- name: NuGet push
run: dotnet nuget push "./${{ env.PACKOUTPUTPATH }}/*.nupkg" --skip-duplicate --source https://api.nuget.org/v3/index.json --api-key ${{ secrets.NUGET_TOKEN }}
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[![Build status](https://ci.appveyor.com/api/projects/status/d2604662svq90a6x/branch/release?svg=true)](https://ci.appveyor.com/project/i8beef/homeautio-mqtt-core/branch/release)
[![Build status](https://ci.appveyor.com/api/projects/status/d2604662svq90a6x/branch/master?svg=true)](https://ci.appveyor.com/project/i8beef/homeautio-mqtt-core/branch/master)
![Build](https://github.com/i8beef/HomeAutio.Mqtt.Core/actions/workflows/build.yml/badge.svg?branch=master)
![Release](https://github.com/i8beef/HomeAutio.Mqtt.Core/actions/workflows/release.yml/badge.svg)

# HomeAutio.Mqtt.Core
Utility library for creating MQTT bridge services
Expand Down
36 changes: 0 additions & 36 deletions appveyor.yml

This file was deleted.

0 comments on commit 2ac21fc

Please sign in to comment.