Update README and comments #94
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: adoscope-nuget-build | |
on: | |
push: | |
branches: | |
- main | |
paths-ignore: | |
- '.github/**' | |
- 'README.md' | |
pull_request: | |
branches: | |
- main | |
paths-ignore: | |
- '.github/**' | |
- 'README.md' | |
workflow_dispatch: | |
env: | |
NuGetDirectory: ${{ github.workspace}}/nuget | |
NuGetDirectoryWin: ${{ github.workspace}}\nuget | |
jobs: | |
versioning: | |
name: Update Version - Revision | |
runs-on: ubuntu-latest | |
steps: | |
- uses: action-pack/set-secret@v1 | |
with: | |
name: 'REVISION' | |
value: $((${{ secrets.REVISION }}+1)) | |
token: ${{ secrets.REPO_ACCESS_TOKEN }} | |
build: | |
name: Build | |
runs-on: windows-latest | |
needs: | |
- versioning | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Setting up build version | |
run: | | |
$major = ${{ vars.MAJOR }} | |
$minor = ${{ vars.MINOR }} | |
$revision = ${{ secrets.REVISION }} | |
$buildVersion = "${major}.${minor}.${revision}-alpha" | |
echo "BuildVersion=${buildVersion}" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: 6.0.x | |
- name: Restore Dependencies | |
working-directory: . | |
run: dotnet restore | |
- name: Build | |
working-directory: . | |
run: dotnet build --no-restore --configuration Release | |
- name: Package | |
working-directory: . | |
run: dotnet pack --no-restore --configuration release --output ${{ env.NuGetDirectory }} | |
- name: Get Certificate | |
id: cert_file | |
uses: timheuer/base64-to-file@v1.2 | |
with: | |
fileName: 'certfile.pfx' | |
encodedString: ${{ secrets.CODE_SIGNING_CERT_PFX }} | |
- name: Upload Nuget Package Artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: Promethix.Framework.Ado.NuGet.${{ env.buildVersion }} | |
if-no-files-found: error | |
retention-days: 7 | |
path: ${{ env.NuGetDirectoryWin }}\*.nupkg | |
test: | |
name: Run Tests | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Restore NuGet packages | |
working-directory: ./Promethix.Framework.Ado.Tests | |
run: dotnet restore | |
- name: Run Tests | |
working-directory: ./Promethix.Framework.Ado.Tests | |
run: dotnet test --no-restore --verbosity normal --filter TestCategory="IntegrationTestsOnCI|Unit" | |
publish: | |
name: Publish Promethix.Framework.Ado | |
needs: | |
- build | |
- test | |
- versioning | |
runs-on: ubuntu-latest | |
steps: | |
- name: Set up build version | |
run: | | |
major="${{ vars.MAJOR }}" | |
minor="${{ vars.MINOR }}" | |
revision="${{ secrets.REVISION }}" | |
buildVersion="${major}.${minor}.${revision}-alpha" | |
echo "buildVersion=${buildVersion}" >> $GITHUB_ENV | |
- uses: actions/download-artifact@v3 | |
with: | |
name: Promethix.Framework.Ado.NuGet.${{ env.buildVersion }} | |
path: ${{ env.NuGetDirectory }} | |
- name: Publish Nuget Package Promethix.Framework.Ado | |
working-directory: . | |
run: | | |
dotnet nuget add source --username gentoorax --password ${{ secrets.REPO_ACCESS_TOKEN }} --store-password-in-clear-text --name github "https://nuget.pkg.github.com/gentoorax/index.json" | |
dotnet nuget push ${{ env.NuGetDirectory }}/*.nupkg --api-key ${{ secrets.REPO_ACCESS_TOKEN }} --source "github" | |
- name: Manual Approval | |
id: approval | |
run: echo "Package is ready for approval - to publish to nuget.org" |