Update License file text with MIT default version #393
Workflow file for this run
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: .NET build | |
on: | |
push: | |
branches: [ master ] | |
pull_request: | |
branches: [ master ] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Determine Git Checkout information | |
id: checkout-info | |
run: | | |
if [ $GITHUB_EVENT_NAME == 'pull_request' ]; then | |
BRANCH_NAME=$(echo ${{ github.event.pull_request.head.ref }}) | |
REPOSITORY_NAME=$(echo ${{ github.event.pull_request.head.repo.full_name }}) | |
else | |
BRANCH_NAME=$(echo ${GITHUB_REF#refs/heads/}) | |
REPOSITORY_NAME=$(echo ${{ github.repository }}) | |
fi | |
echo "BRANCH_NAME=$BRANCH_NAME" >> $GITHUB_ENV | |
echo "REPOSITORY_NAME=$REPOSITORY_NAME" >> $GITHUB_ENV | |
echo "Git checkout information:" | |
echo "Branch name: $BRANCH_NAME" | |
echo "Repository name: $REPOSITORY_NAME" | |
- name: Git Checkout | |
uses: actions/checkout@v2 | |
with: | |
ref: ${{github.event.pull_request.head.ref}} | |
repository: ${{github.event.pull_request.head.repo.full_name}} | |
- name: Force fetch tags | |
run: | | |
# get current repository tags | |
git fetch --tags --force | |
# deal with forked repositories | |
git remote add upstream https://github.com/${{ github.repository }} | |
git fetch --tags upstream | |
- name: Find last tag | |
id: prev-version-tag | |
run: | | |
last_tag=$(git tag -l "*[0-9].*[0-9].*[0-9]*" --sort "-version:refname" | head -n 1) | |
echo "::set-output name=tag::$last_tag" | |
- name: Find last commit message | |
id: last-commit-message | |
run: | | |
last_commit_message=$(git log -1 --pretty=%s $BRANCH_NAME --) | |
echo "Last commit message found:" | |
echo " $last_commit_message" | |
echo "LAST_COMMIT_MESSAGE=$last_commit_message" >> $GITHUB_ENV | |
- name: Bump next build version options | |
id: semvers | |
uses: "WyriHaximus/github-action-next-semvers@v1.0" | |
with: | |
version: ${{ steps.prev-version-tag.outputs.tag }} | |
- name: Set next build version | |
id: build-context | |
env: | |
MAJOR: ${{steps.semvers.outputs.major}} | |
MINOR: ${{steps.semvers.outputs.minor}} | |
PATCH: ${{steps.semvers.outputs.patch}} | |
CURRENT: ${{steps.prev-version-tag.outputs.tag}} | |
run: | | |
echo "::set-output name=current-version::$CURRENT" | |
if [[ $LAST_COMMIT_MESSAGE =~ ^major:.*$ ]]; then | |
echo "Bumping to next major version." | |
NEXT_VERSION="$MAJOR" | |
elif [[ $LAST_COMMIT_MESSAGE =~ ^feat:.*$ ]]; then | |
echo "Bumping to next minor version." | |
NEXT_VERSION="$MINOR" | |
elif [[ $LAST_COMMIT_MESSAGE =~ ^(fix|ci|refactor|chore):.*$ ]]; then | |
echo "Bumping to next patch version." | |
NEXT_VERSION="$PATCH" | |
else | |
echo "Skipping version bump." | |
NEXT_VERSION="$CURRENT" | |
fi | |
if [[ $BRANCH_NAME = 'master' ]]; then | |
echo '::set-output name=context::release' | |
elif [[ $NEXT_VERSION != $CURRENT ]]; then | |
NEXT_VERSION="$NEXT_VERSION-beta" | |
echo '::set-output name=context::beta' | |
else | |
echo '::set-output name=context::beta' | |
fi | |
echo "::set-output name=next-version::$NEXT_VERSION" | |
echo "Next version is: $NEXT_VERSION" | |
echo "BUILD_VERSION=$NEXT_VERSION" >> $GITHUB_ENV | |
- name: Print build version | |
run: echo "Build version will be $BUILD_VERSION" | |
- name: Update project version | |
uses: roryprimrose/set-vs-sdk-project-version@v1 | |
with: | |
projectFilter: '*.csproj' | |
version: ${{ env.BUILD_VERSION }} | |
assemblyVersion: ${{ env.BUILD_VERSION }} | |
fileVersion: ${{ env.BUILD_VERSION }} | |
informationalVersion: ${{ env.BUILD_VERSION }} | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v1 | |
with: | |
dotnet-version: 3.1.x | |
- name: Setup Report Generator | |
run: dotnet tool install --global dotnet-reportgenerator-globaltool | |
- name: Setup Java | |
run: | | |
sudo update-alternatives --query java | |
sudo update-alternatives --auto java | |
export JAVA_HOME=/usr/lib/jvm/java-11-openjdk-amd64/ | |
export PATH=$PATH:$JAVA_HOME | |
- name: MongoDB in GitHub Actions | |
uses: supercharge/mongodb-github-action@1.6.0 | |
with: | |
mongodb-version: '4.4' | |
- name: Restore dependencies | |
run: dotnet restore | |
- name: Build | |
run: dotnet build --no-restore -c Release | |
- name: Test | |
run: dotnet test --no-build --verbosity normal --collect:"XPlat Code Coverage" --results-directory:"../../coverage-outputs" -m:1 -c Release | |
- name: Merge coverage results | |
run: | | |
reportgenerator -reports:"../../coverage-outputs/**/*.xml" -targetdir:"../../coverage-outputs" -reporttypes:SonarQube | |
rm -rfv ../../coverage-outputs/*/ | |
ls -la ../../coverage-outputs | |
- name: Clean | |
run: dotnet clean -c Release | |
- name: Replace Rules.Framework package references w/ project references | |
run: | | |
dotnet remove src/Rules.Framework.Providers.InMemory/Rules.Framework.Providers.InMemory.csproj package Rules.Framework | |
dotnet remove src/Rules.Framework.Providers.MongoDb/Rules.Framework.Providers.MongoDb.csproj package Rules.Framework | |
dotnet add src/Rules.Framework.Providers.InMemory/Rules.Framework.Providers.InMemory.csproj reference src/Rules.Framework/Rules.Framework.csproj | |
dotnet add src/Rules.Framework.Providers.MongoDb/Rules.Framework.Providers.MongoDb.csproj reference src/Rules.Framework/Rules.Framework.csproj | |
- name: Clear Nuget locals | |
run: dotnet nuget locals all --clear | |
- name: Restore dependencies w/ Rules.Framework project reference | |
run: dotnet restore | |
- name: Build w/ Rules.Framework project reference | |
run: dotnet build --no-restore -c Release | |
- name: Test w/ Rules.Framework project reference (no coverage) | |
run: dotnet test --no-build --verbosity normal -m:1 -c Release | |
- name: Delete build tag if exists | |
uses: dev-drprasad/delete-tag-and-release@v0.2.0 | |
continue-on-error: true | |
with: | |
delete_release: false | |
tag_name: ${{ env.BUILD_VERSION }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Set build tag | |
uses: anothrNick/github-tag-action@1.26.0 | |
continue-on-error: true | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
DEFAULT_BUMP: none | |
WITH_V: false | |
CUSTOM_TAG: ${{ env.BUILD_VERSION }} | |
TAG_CONTEXT: branch | |
RELEASE_BRANCHES: .* |