Bump dependencies #48
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 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/[email protected] | |
- uses: actions/[email protected] | |
with: | |
dotnet-version: 6.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/[email protected] | |
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/[email protected] | |
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 | |