Release/1.1.1 #62
This file contains hidden or 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: Build | |
| on: | |
| push: | |
| branches: | |
| - main | |
| - develop | |
| tags: | |
| - '*.*.*' | |
| pull_request: | |
| branches: | |
| - main | |
| - develop | |
| workflow_dispatch: | |
| permissions: | |
| checks: write | |
| statuses: write | |
| contents: write | |
| jobs: | |
| build: | |
| env: | |
| BUILD_CONFIG: 'Release' | |
| SOLUTION: '*.sln' | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup .NET | |
| uses: actions/setup-dotnet@v4 | |
| with: | |
| dotnet-version: '8.0.x' | |
| - name: Get tag for current commit | |
| id: get_tag | |
| # Check for tags when triggered by main branch push (with tag) or direct tag push | |
| # Can't use github.ref_name because it's "main" when pushing branch+tag together | |
| if: github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/') | |
| uses: olegtarasov/get-tag@v2.1.4 | |
| - name: Set Version Profile | |
| run: | | |
| if [[ "${{ steps.get_tag.outputs.tag }}" != "" ]]; then | |
| echo "VERSION_PROFILE=release" >> $GITHUB_ENV | |
| else | |
| echo "VERSION_PROFILE=ci" >> $GITHUB_ENV | |
| fi | |
| - name: Restore dependencies | |
| run: dotnet restore $SOLUTION | |
| - name: Build | |
| run: dotnet build $SOLUTION --configuration $BUILD_CONFIG --no-restore -p:GeneratePackageOnBuild=false -p:VersionProfile=${{ env.VERSION_PROFILE }} | |
| - name: Run tests | |
| run: dotnet test --configuration $BUILD_CONFIG --no-restore --no-build --verbosity normal -p:VersionProfile=${{ env.VERSION_PROFILE }} | |
| - name: Pack NuGet packages | |
| run: | | |
| dotnet pack $SOLUTION --configuration $BUILD_CONFIG --no-build --output ./artifacts -p:VersionProfile=${{ env.VERSION_PROFILE }} | |
| echo "=== Packages created ===" | |
| ls -la ./artifacts/ | |
| - name: Extract release notes from CHANGELOG.md | |
| if: steps.get_tag.outputs.tag != '' | |
| id: extract_notes | |
| uses: mindsers/changelog-reader-action@v2 | |
| with: | |
| version: ${{ steps.get_tag.outputs.tag }} | |
| path: ./CHANGELOG.md | |
| - name: Create GitHub Release | |
| if: steps.get_tag.outputs.tag != '' | |
| uses: softprops/action-gh-release@v1 | |
| with: | |
| tag_name: ${{ steps.get_tag.outputs.tag }} | |
| body: ${{ steps.extract_notes.outputs.changes }} | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |