Skip to content

Commit

Permalink
Merge branch 'release/1.0.0' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
z33bs committed Dec 17, 2020
2 parents a930b4a + 50ec276 commit 8592620
Show file tree
Hide file tree
Showing 10 changed files with 892 additions and 157 deletions.
169 changes: 169 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,169 @@
# Adapted from https://dusted.codes/github-actions-for-dotnet-core-nuget-packages
# ... well explained

name: CI
on:
push:
branches:
- '**'
tags-ignore:
- 'v*'
pull_request:
release:
types:
- published
env:
PROJECT_NAME: ZenMvvm.WeakEventHelpers
# GitHub Packages Feed settings
GITHUB_FEED: https://nuget.pkg.github.com/zenmvvm/
GITHUB_USER: z33bs
GITHUB_USER_EMAIL: zeebsmail@gmail.com
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Official NuGet Feed settings
NUGET_FEED: https://api.nuget.org/v3/index.json
NUGET_KEY: ${{ secrets.NUGET_KEY }}
# MyGet Feed settings
# MYGET_FEED: https://www.myget.org/F/zeebz-open-source/api/v3/index.json
# MYGET_KEY: ${{ secrets.MYGET_KEY}}

# ***** EFFICIENCY SETTINGS *****
# Stop wasting time caching packages
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
# Disable sending usage data to Microsoft
DOTNET_CLI_TELEMETRY_OPTOUT: true
# Project name to pack and publish

jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ ubuntu-latest, windows-latest, macos-latest ]
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup .NET Core
uses: actions/setup-dotnet@v1
with:
dotnet-version: 5.0.100
- name: Restore
run: dotnet restore
- name: Build
run: dotnet build -c Release --no-restore
- name: Test and Generate Coverage Report w. Coverlet
run: dotnet test -c Release /p:CollectCoverage=true /p:CoverletOutputFormat=cobertura /p:CoverletOutput="./"
- name: Run ReportGenerator if develop/deploy
if: matrix.os == 'ubuntu-latest' && (github.ref == 'refs/heads/develop' || github.event_name == 'release')
run: |
dotnet tool install -g dotnet-reportgenerator-globaltool
reportgenerator "-reports:./**/coverage.cobertura.xml" "-targetdir:./coverage" "-reporttypes:Badges;HtmlInline"
- name: Upload Code Coverage Report Artifact if Run
if: matrix.os == 'ubuntu-latest' && (github.ref == 'refs/heads/develop' || github.event_name == 'release')
uses: actions/upload-artifact@v2
with:
name: cov
path: ./coverage/*.*
- name: Set NIGHTLY_PACKAGE_VERSION name
if: matrix.os == 'ubuntu-latest'
env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
run: echo "::set-env name=NIGHTLY_PACKAGE_VERSION::$(date +'0.0.%Y%m%d-%Hh%Mm%S')"
- name: Pack
if: matrix.os == 'ubuntu-latest'
run: dotnet pack -v normal -c Release --no-restore --include-symbols --include-source -p:PackageVersion=$NIGHTLY_PACKAGE_VERSION src/$PROJECT_NAME/$PROJECT_NAME.*proj
- name: Upload Nupkg Artifact
if: matrix.os == 'ubuntu-latest'
uses: actions/upload-artifact@v2
with:
name: nupkg
path: ./src/${{ env.PROJECT_NAME }}/bin/Release/*.nupkg
# - name: If not develop or release, upload Bleeding Edge Package to MyGet
# if: matrix.os == 'ubuntu-latest' && github.ref != 'refs/heads/develop' && github.event_name != 'release'
# run: dotnet nuget push ./src/${{ env.PROJECT_NAME }}/bin/Release/*.nupkg --source $MYGET_FEED --skip-duplicate --api-key $MYGET_KEY

dependabotautomerge:
# from https://github.com/dependabot/dependabot-core/issues/1973
needs: build
if: github.actor == 'dependabot[bot]'
runs-on: ubuntu-latest
steps:
- name: automerge
uses: actions/github-script@0.2.0
with:
script: |
github.pullRequests.createReview({
owner: context.payload.repository.owner.login,
repo: context.payload.repository.name,
pull_number: context.payload.pull_request.number,
event: 'APPROVE'
})
github.pullRequests.merge({
owner: context.payload.repository.owner.login,
repo: context.payload.repository.name,
pull_number: context.payload.pull_request.number
})
github-token: ${{github.token}}

prerelease:
needs: build
if: github.ref == 'refs/heads/develop'
runs-on: ubuntu-latest
steps:
- name: Download Artifact
uses: actions/download-artifact@v2.0.6
with:
name: nupkg
path: nupkg
- name: Publish Nuget to GitHub Feed
run: dotnet nuget push ./nupkg/*.nupkg -k $GITHUB_TOKEN -s $GITHUB_FEED --skip-duplicate

deploy:
needs: build
if: github.event_name == 'release'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Setup .NET Core
uses: actions/setup-dotnet@v1
with:
dotnet-version: 5.0.100
- name: Create Release NuGet package
run: |
arrTag=(${GITHUB_REF//\// })
VERSION="${arrTag[2]}"
echo Version: $VERSION
VERSION="${VERSION//v}"
echo Clean Version: $VERSION
dotnet pack -v normal -c Release --include-symbols --include-source -p:PackageVersion=$VERSION -o nupkg src/$PROJECT_NAME/$PROJECT_NAME.*proj
- name: Publish Nuget to GitHub Feed
run: dotnet nuget push ./nupkg/*.nupkg -k $GITHUB_TOKEN -s $GITHUB_FEED --skip-duplicate
- name: Push to NuGet Feed
run: dotnet nuget push ./nupkg/*.nupkg --source $NUGET_FEED --skip-duplicate --api-key $NUGET_KEY
- name: Checkout develop branch
uses: actions/checkout@v2
with:
ref: develop
- name: Download Coverage Artifact
uses: actions/download-artifact@v2.0.6
with:
name: cov
path: cov
- name: Update coverage badge for readme
run: |
git config --global user.email $GITHUB_USER_EMAIL
git config --global user.name $GITHUB_USER
if [ -d "./coverage" ]; then
rm -f ./coverage/*.*
git add --force ./coverage/badge_linecoverage.svg
git add --force ./coverage/index.html
git commit -m "Remove old coverage badge"
else
mkdir coverage
fi
cp ./cov/badge_linecoverage.svg ./coverage/badge_linecoverage.svg
cp ./cov/index.html ./coverage/index.html
git add --force ./coverage/*.*
git commit -m "Add new coverage badge"
git push
35 changes: 35 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,38 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

=====================================================================

This project uses code from:

* The Xamarin SDK
* [Paul Stovell's Blog](http://paulstovell.com/blog/weakevents)

====================================================================

Xamarin SDK

The MIT License (MIT)

Copyright (c) .NET Foundation Contributors

All rights reserved.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Loading

0 comments on commit 8592620

Please sign in to comment.