Skip to content

Commit

Permalink
Adding CI/CD
Browse files Browse the repository at this point in the history
  • Loading branch information
ShawnLaMountain committed Feb 17, 2022
1 parent b191f17 commit fb7e8ae
Show file tree
Hide file tree
Showing 2 changed files with 96 additions and 0 deletions.
57 changes: 57 additions & 0 deletions .github/workflows/CD.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: CD

on:
release:
types: [published]

env:
TITLE: "A wrapper around 'System.Net.Http.HttpClient'"
DESCRIPTION: "A wrapper around 'System.Net.Http.HttpClient' enhancing AutoRedirect and Cookies. Can be used in all application types."
TAGS: "thunderdesign httpclient threading net"
#FILE_NAME: ex: "ThunderDesign.Net-PCL.HttpClientService"
FILE_NAME: "${{ github.event.repository.name }}"
#REPOSITORY_NAME: ex: "ThunderDesign.Net-PCL.HttpClientService"
REPOSITORY_NAME: ${{ github.event.repository.name }}
#REPOSITORY_OWNER: ex: "ThunderDesign"
REPOSITORY_OWNER: ${{ github.repository_owner }}
#GITHUB_URL: ex: "https://github.com/ThunderDesign"
GITHUB_URL: ${{ github.server_url }}/${{ github.repository_owner }}
#REPOSITORY_URL: ex: "https://github.com/ThunderDesign/ThunderDesign.Net-PCL.HttpClientService"
REPOSITORY_URL: ${{ github.server_url }}/${{ github.repository_owner }}/${{ github.event.repository.name }}

PACKAGE_OUTPUT_DIRECTORY: ${{ github.workspace }}\output

jobs:
pack:

runs-on: [windows-latest]

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

- name: Setup .NET 3.0
uses: actions/setup-dotnet@v1
with:
dotnet-version: 3.0.x

- name: Setup MSBuild
uses: microsoft/setup-msbuild@v1.1

- name: Setup NuGet
uses: NuGet/setup-nuget@v1.0.5

- name: Restore NuGet packages.sln
run: nuget restore ./src/${{ env.FILE_NAME}}.sln

- name: Create NuGet Package
run: msbuild ./src/${{ env.FILE_NAME}}.sln -t:pack /p:VersionPrefix=${{ github.event.release.tag_name }} /p:Configuration=Release /p:Title="${{ env.TITLE }}" /p:Description="${{ env.DESCRIPTION }}" /p:PackageTags="${{ env.TAGS }}" /p:Authors=ThunderDesign /p:PackageProjectUrl=${{ env.GITHUB_URL }} /p:PackageLicenseExpression=MIT /p:RepositoryType=git /p:RepositoryUrl=${{ env.REPOSITORY_URL }} /p:PackageReleaseNotes="See ${{ env.REPOSITORY_URL }}/releases/tag/${{ github.event.release.tag_name }}" /p:PackageOutputPath=${{ env.PACKAGE_OUTPUT_DIRECTORY}}

- name: Archive NuGet Package
uses: actions/upload-artifact@v2.3.1
with:
name: Package_${{ env.FILE_NAME}}.${{ github.event.release.tag_name }}
path: ${{ env.PACKAGE_OUTPUT_DIRECTORY}}\${{ env.FILE_NAME}}.${{ github.event.release.tag_name }}.nupkg

- name: Publish NuGet Package
run: nuget push ${{ env.PACKAGE_OUTPUT_DIRECTORY}}\${{ env.FILE_NAME}}.${{ github.event.release.tag_name }}.nupkg -Source https://api.nuget.org/v3/index.json -ApiKey ${{ secrets.NUGET_API_KEY }}
39 changes: 39 additions & 0 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: CI

on:
workflow_dispatch:
push:
branches: [ main ]
pull_request:
branches: [ main ]

env:
#FILE_NAME: ex: "ThunderDesign.Net-PCL.HttpClientService"
FILE_NAME: "${{ github.event.repository.name }}"

jobs:
build:

runs-on: [windows-latest]

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

- name: Setup .NET 3.0
uses: actions/setup-dotnet@v1
with:
dotnet-version: 3.0.x

- name: Setup MSBuild
uses: microsoft/setup-msbuild@v1.1

- name: Setup NuGet
uses: NuGet/setup-nuget@v1.0.5

- name: Restore NuGet packages
run: nuget restore ./src/${{ env.FILE_NAME}}.sln

- name: Build Solution
run: msbuild ./src/${{ env.FILE_NAME}}.sln /p:Configuration=Release

0 comments on commit fb7e8ae

Please sign in to comment.