Update BuildAutomationTool.csproj #14
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
| # .github/workflows/dotnet.yml | |
| name: .NET CI | |
| on: | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| branches: | |
| - main | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v2 | |
| with: | |
| token: ${{ secrets.GITHUB_TOKEN }} # Ensures we have permission to push changes back | |
| - name: Setup .NET | |
| uses: actions/setup-dotnet@v3 | |
| with: | |
| dotnet-version: '7.x' # Specify the version or use 'latest' for the most recent | |
| - name: Run BumpVersion script | |
| shell: pwsh | |
| run: ./BumpVersion.ps1 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Commit version changes | |
| run: | | |
| git config --global user.name "github-actions[bot]" | |
| git config --global user.email "github-actions[bot]@users.noreply.github.com" | |
| git add . | |
| git commit -m "Bump version number" | |
| continue-on-error: true # Avoids errors if there are no changes to commit | |
| - name: Push version changes | |
| if: ${{ success() }} | |
| run: | | |
| git push origin main | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Install dependencies | |
| run: cd Tool/BuildAutomationTool && dotnet restore BuildAutomationTool.sln | |
| - name: Lint the code | |
| run: cd Tool/BuildAutomationTool && dotnet format --verify-no-changes | |
| continue-on-error: true | |
| - name: Build the project | |
| run: cd Tool/BuildAutomationTool && dotnet build BuildAutomationTool.sln --no-restore --configuration Release | |
| - name: Run unit tests | |
| run: cd Tool/BuildAutomationTool && dotnet test BuildAutomationTool.sln --no-build --configuration Release --verbosity normal | |
| - name: Package the project | |
| run: cd Tool/BuildAutomationTool && dotnet pack BuildAutomationTool.sln --no-build --configuration Release -o ./artifacts | |
| - name: Publish package to GitHub Packages | |
| if: github.ref == 'refs/heads/main' && success() # Publish only on successful builds of the main branch | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: cd Tool/BuildAutomationTool && dotnet nuget push ./artifacts/*.nupkg --source "https://nuget.pkg.github.com/LoveDuckie/index.json" --api-key ${{ secrets.GITHUB_TOKEN }} |