Skip to content
This repository has been archived by the owner on Jan 16, 2022. It is now read-only.

Commit

Permalink
Add CI and release pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
Abrynos committed Jul 28, 2021
1 parent 0bac58c commit d1dcfca
Show file tree
Hide file tree
Showing 2 changed files with 89 additions and 0 deletions.
35 changes: 35 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: CI

on: [ push, pull_request ]

env:
CONFIGURATION: Release
DOTNET_CLI_TELEMETRY_OPTOUT: 1
TEST_PROJECT_NAME: Implement.Net.Tests

jobs:
main:
strategy:
fail-fast: true
matrix:
os: [ macos-latest, ubuntu-latest, windows-latest ]

runs-on: ${{ matrix.os }}

steps:
- name: Checkout
uses: actions/checkout@v2

- name: Set .NET core up
uses: actions/[email protected]
with:
dotnet-version: 5.0.x

- name: Verify .NET core
run: dotnet --info

- name: Build all projects
run: dotnet build --configuration "${{ env.CONFIGURATION }}" -p:ContinuousIntegrationBuild=true

- name: Run tests
run: dotnet test "${{ env.TEST_PROJECT_NAME }}" --configuration "${{ env.CONFIGURATION }}" -p:ContinuousIntegrationBuild=true
54 changes: 54 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Release

on:
push:
tags:
- 'v*.*.*'

env:
CONFIGURATION: Release
DOTNET_CLI_TELEMETRY_OPTOUT: 1
TEST_PROJECT_NAME: Implement.Net.Tests
OUTPUT_DIRECTORY: "./out"
RELEVANT_OUTPUT_FILES: "./out/*.nupkg"

jobs:
main:
runs-on: ubuntu-latest

steps:
- name: Add release tag to environment
run: echo "RELEASE_TAG=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV

- name: Checkout
uses: actions/checkout@v2
with:
ref: ${{ env.RELEASE_TAG }}

- name: Set .NET core up
uses: actions/[email protected]
with:
dotnet-version: 5.0.x

- name: Verify .NET core
run: dotnet --info

- name: Build all projects
run: dotnet build --configuration "${{ env.CONFIGURATION }}" -p:ContinuousIntegrationBuild=true

- name: Run tests
run: dotnet test "${{ env.TEST_PROJECT_NAME }}" --configuration "${{ env.CONFIGURATION }}" -p:ContinuousIntegrationBuild=true

- name: Pack
run: dotnet pack --configuration ${{ env.CONFIGURATION }} --output "${{ env.OUTPUT_DIRECTORY }}"

- name: Create GitHub release
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
files: ${{ env.RELEVANT_OUTPUT_FILES }}
tag_name: ${{ env.RELEASE_TAG }}

- name: Push to NuGet
run: dotnet nuget push "${{ env.RELEVANT_OUTPUT_FILES }}" --api-key ${{ secrets.NUGET_TOKEN }} --source https://api.nuget.org/v3/index.json

0 comments on commit d1dcfca

Please sign in to comment.