Refactor: Better Projections #304
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
on: pull_request | |
name: Publish to Beta | |
jobs: | |
milestone: | |
name: Try Parsing Milestone | |
runs-on: ubuntu-latest | |
outputs: | |
is_semantic_version: ${{ steps.parse.outputs.is_semantic_version }} | |
version: ${{ github.event.pull_request.milestone.title }} | |
steps: | |
- id: parse | |
env: | |
GITHUB_MILESTONE: ${{ github.event.pull_request.milestone.title }} | |
run: | | |
# This pattern comes from https://semver.org/#is-there-a-suggested-regular-expression-regex-to-check-a-semver-string | |
# However, Bash uses POSIX regular expressions, and there are some unsupported features. | |
# POSIX does not support non-capturing groups: (?:...) | |
# - To make it compatible, the non-capture modifiers have been removed | |
# POSIX does not support the digit metacharacter: \d | |
# - To make it compatible, the digit metacharacters have been replaced with [0-9] | |
semantic_version_pattern='^(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)(-((0|[1-9][0-9]*|[0-9]*[a-zA-Z-][0-9a-zA-Z-]*)(\.(0|[1-9][0-9]*|[0-9]*[a-zA-Z-][0-9a-zA-Z-]*))*))?(\+([0-9a-zA-Z-]+(\.[0-9a-zA-Z-]+)*))?$' | |
if [[ ${GITHUB_MILESTONE} =~ $semantic_version_pattern ]]; then | |
echo "is_semantic_version=true" >> $GITHUB_OUTPUT | |
else | |
echo "is_semantic_version=false" >> $GITHUB_OUTPUT | |
fi | |
beta: | |
needs: milestone | |
if: ${{ needs.milestone.outputs.is_semantic_version == 'true' }} | |
name: Publish to Beta | |
runs-on: ubuntu-latest | |
environment: beta | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v3 | |
- name: Install .NET SDK | |
uses: actions/setup-dotnet@v3 | |
- name: Restore Dependencies | |
run: dotnet restore EntityDb.sln --locked-mode | |
- name: Run Project Tests | |
run: dotnet test EntityDb.sln --no-restore -c Debug --collect:"XPlat Code Coverage" --results-directory ./TestResults -- DataCollectionRunSettings.DataCollectors.DataCollector.Configuration.Format=opencover | |
- name: Pack Projects into Nuget Packages | |
run: dotnet pack EntityDb.sln --no-restore -c Release /p:Version='${{ needs.milestone.outputs.version }}-beta.${{ github.event.number }}.${{ github.run_number }}.${{ github.run_attempt }}' | |
- name: Publish to Beta | |
run: dotnet nuget push ./**/*.nupkg -s ${{ vars.NUGET_SOURCE }} -k ${{ secrets.NUGET_API_KEY }} | |
- name: Packages & Symbols Artifact | |
uses: actions/[email protected] | |
with: | |
name: Packages & Symbols | |
path: | | |
./**/*.nupkg | |
./**/*.snupkg | |
- name: Publish Coverage Results to Codacy | |
uses: codacy/codacy-coverage-reporter-action@v1 | |
with: | |
project-token: ${{ secrets.CODACY_PROJECT_TOKEN }} | |
coverage-reports: ./TestResults/**/*.xml | |
- name: Generate Coverage Report | |
uses: danielpalme/[email protected] | |
with: | |
reports: './TestResults/**/coverage.opencover.xml' | |
targetdir: 'CoverageReport' | |
reporttypes: 'HtmlInline' | |
license: ${{ secrets.REPORTGENERATOR_LICENSE }} | |
toolpath: 'reportgeneratortool' | |
- name: Coverage Report Artifact | |
uses: actions/[email protected] | |
with: | |
name: CoverageReport | |
path: CoverageReport |