Skip to content

(#183) Copy env to second stage #7

(#183) Copy env to second stage

(#183) Copy env to second stage #7

Workflow file for this run

name: Stravaig Test Capture Logger V3
on:
push:
branches:
- main
- '#183/workflow'
paths-ignore:
- 'README.md'
- 'Example/**'
- '.vscode/**'
- '.gitignore'
- 'contributors.md'
- 'release-notes/**'
pull_request:
types: [assigned, opened, synchronize, reopened]
paths-ignore:
- 'README.md'
- 'Example/**'
- '.vscode/**'
- '.gitignore'
workflow_dispatch:
jobs:
build:
name: Build, Test, and Release
runs-on: ubuntu-latest
steps:
- name: Set Time Zone to Europe/London
shell: pwsh
run: sudo timedatectl set-timezone "Europe/London"
- name: Check out code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set version number
shell: pwsh
run: ./Set-Version.ps1 -IsPublic "${{ github.event.inputs.isPublic }}" -IsPreview "${{ github.event.inputs.isPreview }}"
- name: Display workflow state
run: |
echo "Package version: $STRAVAIG_PACKAGE_VERSION"
echo "Version Suffix: $STRAVAIG_PACKAGE_VERSION_SUFFIX"
echo "Full Version: $STRAVAIG_PACKAGE_FULL_VERSION"
echo "Publish To NuGet: $STRAVAIG_PUBLISH_TO_NUGET"
echo "Is Preview: $STRAVAIG_IS_PREVIEW"
echo "Is Stable: $STRAVAIG_IS_STABLE"
- uses: actions/setup-dotnet@v4
name: Setup .NET 6.0, 8.0 & 9.0
with:
dotnet-version: |
6.0.x
8.0.x
9.0.x
# - name: .NET State
# run: dotnet --info
- name: Build Solution
run: dotnet build src/Stravaig.Extensions.Logging.Diagnostics.sln --configuration Release
- name: Run Tests
run: dotnet test src/Stravaig.Extensions.Logging.Diagnostics.Tests/Stravaig.Extensions.Logging.Diagnostics.Tests.csproj --configuration Release
- name: Package Preview Release (main)
run: dotnet pack ./src/Stravaig.Extensions.Logging.Diagnostics/Stravaig.Extensions.Logging.Diagnostics.csproj --configuration Release --output ./out/preview --include-symbols --include-source /p:VersionPrefix="$STRAVAIG_PACKAGE_VERSION" --version-suffix "$STRAVAIG_PACKAGE_VERSION_SUFFIX" -p:IncludeSymbols=true -p:SymbolPackageFormat=snupkg
- name: Package Preview Release (xunit)
run: dotnet pack ./src/Stravaig.Extensions.Logging.Diagnostics.XUnit/Stravaig.Extensions.Logging.Diagnostics.XUnit.csproj --configuration Release --output ./out/preview --include-symbols --include-source /p:VersionPrefix="$STRAVAIG_PACKAGE_VERSION" --version-suffix "$STRAVAIG_PACKAGE_VERSION_SUFFIX" -p:IncludeSymbols=true -p:SymbolPackageFormat=snupkg
- name: Package Stable Release (main)
run: dotnet pack ./src/Stravaig.Extensions.Logging.Diagnostics/Stravaig.Extensions.Logging.Diagnostics.csproj --configuration Release --output ./out/stable --include-symbols --include-source /p:VersionPrefix="$STRAVAIG_PACKAGE_VERSION" -p:IncludeSymbols=true -p:SymbolPackageFormat=snupkg
- name: Package Stable Release (xunit)
run: dotnet pack ./src/Stravaig.Extensions.Logging.Diagnostics.XUnit/Stravaig.Extensions.Logging.Diagnostics.XUnit.csproj --configuration Release --output ./out/stable --include-symbols --include-source /p:VersionPrefix="$STRAVAIG_PACKAGE_VERSION" -p:IncludeSymbols=true -p:SymbolPackageFormat=snupkg
# - name: List Packages
# run: ls -R -l ./out
#
- name: Archive Packages
uses: actions/upload-artifact@v4
with:
name: packages
path: |
./out/**
retention-days: 7
- name: List Contributors
shell: pwsh
run: ./list-contributors.ps1 -HideAKAs -HideSummaryAwards
- name: Build Release Notes
shell: pwsh
run: ./build-release-notes.ps1
- name: Archive Release Notes
uses: actions/upload-artifact@v4
with:
name: release-information
path: |
contributors.md
release-notes/full-release-notes.md
release-notes/release-notes-${{ env.STRAVAIG_PACKAGE_FULL_VERSION }}.md
retention-days: 7
publish-preview:
runs-on: ubuntu-latest
needs: build
environment: preview-release
steps:
- name: Download Packages
uses: actions/download-artifact@v4
with:
name: packages
path: ./packages
- name: Apply Env Vars
shell: pwsh
run: Get-Content ./packages/version-info.env | Out-File -FilePath $env:GITHUB_ENV -Encoding UTF8 -Append -Verbose
- name: Environment
run: env | sort
- name: List Workspace
run: ls -R -l .
# - name: Push package to NuGet
# shell: pwsh
# run: |
# Get-ChildItem ./packages/preview/*.nupkg | ForEach-Object {
# $name = $_.FullName;
# Write-Output "Pushing $name";
# dotnet nuget push "$name" --api-key ${{ secrets.STRAVAIG_NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json
publish-stable:
runs-on: ubuntu-latest
needs: build
environment: stable-release
steps:
- name: Environment
run: env | sort
- name: Download Packages
uses: actions/download-artifact@v4
with:
name: packages
path: ./packages
- name: Download Release Information
uses: actions/download-artifact@v4
with:
name: release-information
path: ./release-information
- name: List Workspace
run: ls -R -l .
# - name: Push package to NuGet
# shell: pwsh
# run: |
# Get-ChildItem ./out/preview/*.nupkg | ForEach-Object {
# $name = $_.FullName;
# Write-Output "Pushing $name";
# dotnet nuget push "$name" --api-key ${{ secrets.STRAVAIG_NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json
# }
#
#
- name: Create Release
shell: pwsh
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
Copy-Item -Path ./release-information/contributors.md -Destination ./contributors.md -Force
Copy-Item -Path ./release-information/full-release-notes.md -Destination ./release-notes/full-release-notes.md -Force
Copy-Item -Path ./release-information/release-notes-${{ env.STRAVAIG_PACKAGE_FULL_VERSION }}.md -Destination ./release-notes/release-notes-${{ env.STRAVAIG_PACKAGE_FULL_VERSION }}.md -Force
$assets = @();
$assets += "./out/*.nupkg"
$assets += "./out/*.snupkg"
$assets += "LICENSE"
$assets += "contributors.md"
$assets += "README.md"
$assets += "./release-notes/release-notes-${{ env.STRAVAIG_PACKAGE_FULL_VERSION }}.md"
./Create-Release.ps1 -NotesFile "./release-body.md" -Assets $assets
#
# - name: Bump version
# #IF Publishing & Stable release
# if: ${{ env.STRAVAIG_PUBLISH_TO_NUGET == 'true' && env.STRAVAIG_IS_STABLE == 'true' }}
# shell: pwsh
# run: ./Bump-Version.ps1 -BumpPatch
#
# - name: Reset WIP release notes
# #IF Publishing & Stable release
# if: ${{ env.STRAVAIG_PUBLISH_TO_NUGET == 'true' && env.STRAVAIG_IS_STABLE == 'true' }}
# shell: pwsh
# run: ./Reset-WipReleaseNotes.ps1
#
# - name: Commit post release updates
# #IF Publishing & Stable release
# if: ${{ env.STRAVAIG_PUBLISH_TO_NUGET == 'true' && env.STRAVAIG_IS_STABLE == 'true' }}
# uses: EndBug/add-and-commit@v9
# with:
# add: ./contributors.md ./release-notes/** ./version.txt
# author_name: StravaigBot
# author_email: [email protected]
# message: "[bot] Post v${{ env.STRAVAIG_PACKAGE_FULL_VERSION }} release updates & bump version."
# push: true
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}