Skip to content

Commit

Permalink
Update main.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
jstedfast authored Oct 15, 2024
1 parent 15e2662 commit 735f673
Showing 1 changed file with 20 additions and 31 deletions.
51 changes: 20 additions & 31 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ jobs:
- name: Configure build options
id: configure
shell: pwsh
env:
GITHUB_EVENT_NAME: ${{ github.event_name }}
GITHUB_REF: ${{ github.ref }}
OS: ${{ matrix.os }}
run: |
$IS_DEBUG = 'false'
$IS_RELEASE = 'false'
Expand Down Expand Up @@ -62,15 +66,6 @@ jobs:
$GENERATE_CODE_COVERAGE = 'yes'
}
echo "is_debug=$IS_DEBUG" >> $GITHUB_OUTPUT
echo "is_release=$IS_RELEASE" >> $GITHUB_OUTPUT
echo "is_push_to_master=$IS_PUSH_TO_MASTER" >> $GITHUB_OUTPUT
echo "is_not_pr=$IS_NOT_PR" >> $GITHUB_OUTPUT
echo "is_github_release=$IS_GITHUB_RELEASE" >> $GITHUB_OUTPUT
echo "is_windows=$IS_WINDOWS" >> $GITHUB_OUTPUT
echo "is_ubuntu=$IS_UBUNTU" >> $GITHUB_OUTPUT
echo "generate_code_coverage=$GENERATE_CODE_COVERAGE" >> $GITHUB_OUTPUT
echo "is_debug=$IS_DEBUG"
echo "is_release=$IS_RELEASE"
echo "is_push_to_master=$IS_PUSH_TO_MASTER"
Expand All @@ -79,10 +74,15 @@ jobs:
echo "is_windows=$IS_WINDOWS"
echo "is_ubuntu=$IS_UBUNTU"
echo "generate_code_coverage=$GENERATE_CODE_COVERAGE"
env:
GITHUB_EVENT_NAME: ${{ github.event_name }}
GITHUB_REF: ${{ github.ref }}
OS: ${{ matrix.os }}
echo "is_debug=$IS_DEBUG" >> $GITHUB_OUTPUT
echo "is_release=$IS_RELEASE" >> $GITHUB_OUTPUT
echo "is_push_to_master=$IS_PUSH_TO_MASTER" >> $GITHUB_OUTPUT
echo "is_not_pr=$IS_NOT_PR" >> $GITHUB_OUTPUT
echo "is_github_release=$IS_GITHUB_RELEASE" >> $GITHUB_OUTPUT
echo "is_windows=$IS_WINDOWS" >> $GITHUB_OUTPUT
echo "is_ubuntu=$IS_UBUNTU" >> $GITHUB_OUTPUT
echo "generate_code_coverage=$GENERATE_CODE_COVERAGE" >> $GITHUB_OUTPUT
- if: ${{ steps.configure.outputs.is_windows == 'true' }}
name: Setup MSBuild
Expand Down Expand Up @@ -110,7 +110,6 @@ jobs:
- if: ${{ steps.configure.outputs.is_github_release == 'true' }}
name: Get latest tag
id: get_latest_tag
shell: pwsh
run: |
$LATEST_TAG = git -c 'versionsort.suffix=-' ls-remote --exit-code --refs --sort='version:refname' --tags "https://github.com/$env:GIT_URL.git" '*.*.*' | tail --lines=1 | cut --delimiter='/' --fields=3
echo "tag=$LATEST_TAG" >> $GITHUB_OUTPUT
Expand All @@ -121,7 +120,6 @@ jobs:
name: Add new tag to repo
id: add_new_tag_to_repo
continue-on-error: true
shell: pwsh
run: |
git config --global user.name $env:GIT_USER_NAME
git config --global user.email $env:GIT_USER_EMAIL
Expand All @@ -133,36 +131,32 @@ jobs:
NEW_VERSION_NUM: ${{ steps.semantic_version.outputs.version_num }}

- name: Run .NET restore
shell: pwsh
run: |
dotnet restore $env:SOLUTION_PATH
- name: Run .NET tool restore
shell: pwsh
run: |
dotnet tool restore
- name: Build solution
id: build_solution
continue-on-error: true
shell: pwsh
run: |
echo "SOLUTION_PATH=$env:SOLUTION_PATH"
echo "BUILD_PLATFORM=$env:BUILD_PLATFORM"
echo "BUILD_CONFIGURATION=$env:BUILD_CONFIGURATION"
echo "IS_UBUNTU=$env:IS_UBUNTU"
dotnet msbuild $env:SOLUTION_PATH -property:Platform=$env:BUILD_PLATFORM -property:Configuration=$env:BUILD_CONFIGURATION -property:MonoRuntime=$env:IS_UBUNTU
echo "USE_MONO_RUNTIME=$env:USE_MONO_RUNTIME"
dotnet msbuild $env:SOLUTION_PATH -property:Platform=$env:BUILD_PLATFORM -property:Configuration=$env:BUILD_CONFIGURATION -property:MonoRuntime=$env:USE_MONO_RUNTIME
env:
IS_UBUNTU: ${{ steps.configure.outputs.is_ubuntu }}
USE_MONO_RUNTIME: ${{ steps.configure.outputs.is_ubuntu }}

- name: Run unit tests
id: run_unit_tests
continue-on-error: true
shell: pwsh
run: |
echo "BUILD_CONFIGURATION=$env:BUILD_CONFIGURATION"
echo "GENERATE_CODE_COVERAGE=$env:GENERATE_CODE_COVERAGE"
& ./scripts/test.ps1 -Configuration "$env:BUILD_CONFIGURATION" -GenerateCodeCoverage "$env:GENERATE_CODE_COVERAGE"
pwsh ./scripts/test.ps1 -Configuration "$env:BUILD_CONFIGURATION" -GenerateCodeCoverage "$env:GENERATE_CODE_COVERAGE"
env:
GENERATE_CODE_COVERAGE: ${{ steps.configure.outputs.generate_code_coverage }}

Expand All @@ -177,9 +171,8 @@ jobs:
- if: ${{ steps.configure.outputs.generate_code_coverage == 'yes' }}
name: Upload code coverage data to coveralls.io
id: upload_to_coveralls
shell: pwsh
run: |
& ./scripts/coveralls.ps1
pwsh ./scripts/coveralls.ps1
env:
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
GIT_COMMIT_SHA: ${{ github.sha }}
Expand All @@ -192,10 +185,8 @@ jobs:
- if: ${{ steps.configure.outputs.is_github_release == 'true' }}
name: Create NuGet package
id: create_nuget_package
shell: pwsh
run: |
nuget pack nuget/MimeKit.nuspec `
-Version "$env:LATEST_VERSION.$env:GITHUB_RUN_NUMBER"
nuget pack nuget/MimeKit.nuspec -Version "$env:LATEST_VERSION.$env:GITHUB_RUN_NUMBER"
env:
LATEST_VERSION: ${{ steps.semantic_version.outputs.version_num }}

Expand All @@ -204,9 +195,7 @@ jobs:
id: push_nuget_package
shell: pwsh
run: |
nuget push $env:NUGET_PKG_PATH `
-ApiKey $env:MYGET_API_KEY `
-Source https://www.myget.org/F/mimekit/api/v3/index.json
nuget push $env:NUGET_PKG_PATH -ApiKey $env:MYGET_API_KEY -Source https://www.myget.org/F/mimekit/api/v3/index.json
env:
NUGET_PKG_PATH: MimeKit.${{ steps.semantic_version.outputs.version_num }}.${{ env.GITHUB_RUN_NUMBER }}.nupkg
MYGET_API_KEY: ${{ secrets.MYGET_API_KEY }}
Expand Down

0 comments on commit 735f673

Please sign in to comment.