Skip to content

update test

update test #308

Workflow file for this run

name: .NET Core
on:
push:
pull_request:
release:
types:
- published
env:
# Stop wasting time caching packages
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
# Disable sending usage data to Microsoft
DOTNET_CLI_TELEMETRY_OPTOUT: true
# Project name to pack and publish
PROJECT_NAME: DEdge.Cardidy
# GitHub Packages Feed settings
GITHUB_FEED: https://nuget.pkg.github.com/d-edge/
GITHUB_USER: aloisdg
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Official NuGet Feed settings
NUGET_FEED: https://api.nuget.org/v3/index.json
NUGET_KEY: ${{ secrets.NUGET_KEY }}
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup .NET Core
uses: actions/setup-dotnet@v1
with:
dotnet-version: '7.0'
- name: Restore
run: dotnet restore
- name: Build
run: dotnet build -c Release --no-restore
- name: Test
run: dotnet test -c Release
- name: Strip HTML from README
uses: d-edge/[email protected]
with:
input-path: README.md
output-path: src/${{ env.PROJECT_NAME }}/README.md
- name: Pack
if: matrix.os == 'ubuntu-latest'
run: |
if [ "$GITHUB_REF_TYPE" = "tag" ]; then
arrTag=(${GITHUB_REF//\// })
version="${arrTag[2]}"
echo Version: $version
version="${version//v}"
echo Clean Version: $version
else
git fetch --prune --unshallow --tags --quiet
latestTag=$(git describe --tags --abbrev=0 2>/dev/null || echo 0.0.1)
runId=$GITHUB_RUN_ID
version="${latestTag//v}-build.${runId}"
echo Non-release version: $version
fi
dotnet pack -v normal -c Release --no-restore --include-symbols --include-source -p:PackageVersion=$version src/$PROJECT_NAME/$PROJECT_NAME.*proj
- name: Upload Artifact
if: matrix.os == 'ubuntu-latest'
uses: actions/upload-artifact@v2
with:
name: nupkg
path: ./src/${{ env.PROJECT_NAME }}/bin/Release/*.nupkg
prerelease:
needs: build
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
steps:
- name: Download Artifact
uses: actions/download-artifact@v1
with:
name: nupkg
- name: Push to GitHub Feed
run: |
for f in ./nupkg/*.nupkg
do
curl -vX PUT -u "$GITHUB_USER:$GITHUB_TOKEN" -F package=@$f $GITHUB_FEED
done
deploy:
needs: build
if: github.event_name == 'release'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Setup .NET Core
uses: actions/setup-dotnet@v1
with:
dotnet-version: '7.0'
- name: Download Artifact
uses: actions/download-artifact@v1
with:
name: nupkg
- name: Push to GitHub Feed
run: |
for f in ./nupkg/*.nupkg
do
curl -vX PUT -u "$GITHUB_USER:$GITHUB_TOKEN" -F package=@$f $GITHUB_FEED
done
- name: Push to NuGet Feed
run: dotnet nuget push ./nupkg/*.nupkg --source $NUGET_FEED --skip-duplicate --api-key $NUGET_KEY