Update ci.yaml #9
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
# .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 | |
- 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: ./Tool/BuildAutomationTool/BumpVersion.ps1 | |
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 }} |