Repository navigation
Fix SBFM/UBFM aliases #114
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: .NET Core - Release | |
| on: | |
| push: | |
| branches: [ master ] | |
| pull_request: | |
| branches: [ master ] | |
| jobs: | |
| tests: | |
| name: Run Tests & Publish Dev Package | |
| runs-on: ubuntu-latest | |
| if: github.repository == 'SamboyCoding/Disarm' | |
| steps: | |
| - uses: actions/checkout@v7 | |
| - uses: actions/setup-dotnet@v5.2.0 | |
| with: | |
| dotnet-version: 10.x | |
| - id: git-vars | |
| name: Set up environment | |
| shell: bash | |
| run: | | |
| echo "##[set-output name=git_branch;]$(echo $GITHUB_REF)" | |
| echo "::set-output name=git_hash::$(git rev-parse --short HEAD)" | |
| - id: set-vars | |
| uses: actions/github-script@v9.0.0 | |
| with: | |
| script: | | |
| let gitHash = "${{ steps.git-vars.outputs.git_hash }}"; | |
| let runNumber = "${{ github.run_number }}"; | |
| let rawGitRef = "${{ steps.git-vars.outputs.git_branch }}"; | |
| console.log("rawGitRef: " + rawGitRef); | |
| let gitRef = rawGitRef.replace(/^refs\/heads\//, ""); | |
| if(gitRef.indexOf("refs/pull/") === 0) { | |
| gitRef = "pr-" + gitRef.substring(10, gitRef.lastIndexOf("/")); | |
| } | |
| var versString = `${gitRef}.${runNumber}+${gitHash}`; | |
| console.log(versString); | |
| core.setOutput("versionString", versString); | |
| - name: Install dependencies | |
| run: dotnet restore /p:VersionSuffix=${{ steps.set-vars.outputs.versionString }} | |
| - name: Run Tests | |
| run: dotnet test -c Release /p:VersionSuffix=${{ steps.set-vars.outputs.versionString }} --verbosity normal /p:CollectCoverage=true /p:CoverletOutputFormat=lcov /p:CoverletOutput='./lcov.info' | |
| - name: Upload test coverage | |
| uses: coverallsapp/github-action@v2.3.8 | |
| with: | |
| github-token: ${{ secrets.GITHUB_TOKEN }} | |
| file: ./Disarm.Tests/lcov.info | |
| - name: Build all | |
| run: dotnet build -c Release /p:VersionSuffix=${{ steps.set-vars.outputs.versionString }} | |
| working-directory: Disarm.Tests | |
| - name: Publish to Dev NuGet | |
| if: github.event_name == 'push' | |
| run: dotnet nuget push -s https://nuget.samboy.dev/v3/index.json -k ${{ secrets.BAGET_KEY }} ./Disarm/bin/Release/*.nupkg | |
| - name: Upload to NuGet | |
| if: contains(github.event.head_commit.message, '[publish]') == true && github.event_name == 'push' | |
| env: | |
| NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }} | |
| run: dotnet nuget push ./Disarm/bin/Release/*.nupkg -s https://api.nuget.org/v3/index.json -k $NUGET_API_KEY | |