Updated deprecated actions versions #4
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: measurements-tool-nuget-package | |
# https://docs.github.com/es/actions/deployment/about-deployments/deploying-with-github-actions#using-concurrency | |
concurrency: | |
group: production | |
cancel-in-progress: false | |
on: | |
push: | |
branches: [ "master" ] | |
# Allows you to run this workflow manually from the Actions tab on GitHub. | |
workflow_dispatch: | |
jobs: | |
build: | |
name: Build | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v2 | |
with: | |
dotnet-version: 6.0.x | |
- name: Restore dependencies | |
run: dotnet restore | |
- name: Build | |
run: dotnet build --configuration Release --no-restore | |
- name: Package | |
run: dotnet pack -c Release -o . MeasurementsTool.sln | |
# - name: Console Command list files | |
# run: | | |
# ls -R | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: solution-build | |
path: MeasurementsTool.*.nupkg | |
tests: | |
name: Run tests | |
runs-on: ubuntu-latest | |
needs: [build] | |
steps: | |
- uses: actions/checkout@v4 | |
# - name: Test | |
# run: dotnet test MeasurementsTool.sln | |
- name: Test | |
run: dotnet test --collect:"XPlat Code Coverage" --results-directory:./CoverageResults/ MeasurementsTool.sln | |
- name: Move coverage result files | |
run: | | |
echo MOVER COVERAGE RESULTS | |
cp CoverageResults/*/*.xml CoverageResults/ | |
- name: Codecov | |
uses: codecov/[email protected] | |
with: | |
name: Code coverage report | |
files: CoverageResults/coverage.cobertura.xml | |
flags: unittests | |
verbose: false | |
publish-github-package: | |
name: Publish GitHub package | |
runs-on: ubuntu-latest | |
needs: [build, tests] | |
steps: | |
- uses: actions/download-artifact@v4 | |
with: | |
name: solution-build | |
path: . | |
- name: Add GitHub package source | |
run: dotnet nuget add source --username Sergi0Martin --password ${{ secrets.GITHUB_TOKEN }} --store-password-in-clear-text --name MeasurementsTool "https://nuget.pkg.github.com/Sergi0Martin/index.json" | |
- name: Publish on GitHub Packages | |
run: dotnet nuget push MeasurementsTool.*.nupkg --api-key ${{ secrets.PUBLISHING_PACKAGES_PAT }} --source "MeasurementsTool" | |
publish-github-release: | |
name: Publish GitHub release | |
if: ${{ false }} # step disabled with false | |
runs-on: ubuntu-latest | |
needs: [build, tests] | |
steps: | |
- uses: actions/download-artifact@v4 | |
with: | |
name: solution-build | |
path: . | |
- name: Create Release | |
# if: ${{ false }} # step disabled with false | |
uses: softprops/action-gh-release@v1 | |
# if: startsWith(github.ref, 'refs/tags/') | |
with: | |
tag_name: release | |
files: | | |
*.nupkg | |
publish-nuget: | |
name: Publish nuget | |
runs-on: ubuntu-latest | |
environment: | |
name: production | |
url: https://www.nuget.org/packages/MeasurementsTool/ | |
needs: [build, tests] | |
steps: | |
- uses: actions/download-artifact@v4 | |
with: | |
name: solution-build | |
path: . | |
- name: Publish on nuget.org | |
run: dotnet nuget push *.nupkg --api-key ${{ secrets.PUBLISHING_PACKAGES_PAT }} --source https://api.nuget.org/v3/index.json |