|
| 1 | +# Credits due: by https://dusted.codes/github-actions-for-dotnet-core-nuget-packages#branch-and-pull-request-trigger |
| 2 | + |
| 3 | +name: Release |
| 4 | + |
| 5 | +on: |
| 6 | + release: |
| 7 | + types: |
| 8 | + - published |
| 9 | + |
| 10 | +env: |
| 11 | + # Stop wasting time caching packages |
| 12 | + DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true |
| 13 | + # Disable sending usage data to Microsoft |
| 14 | + DOTNET_CLI_TELEMETRY_OPTOUT: true |
| 15 | + # GitHub Packages Feed settings |
| 16 | + GITHUB_FEED: https://nuget.pkg.github.com/koenbeuk/ |
| 17 | + GITHUB_USER: koenbeuk |
| 18 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 19 | + # Official NuGet Feed settings |
| 20 | + NUGET_FEED: https://api.nuget.org/v3/index.json |
| 21 | + NUGET_KEY: ${{ secrets.NUGET_KEY }} |
| 22 | + |
| 23 | +jobs: |
| 24 | + deploy: |
| 25 | + runs-on: ubuntu-latest |
| 26 | + steps: |
| 27 | + - uses: actions/checkout@v2 |
| 28 | + - name: Setup .NET Core |
| 29 | + uses: actions/setup-dotnet@v1 |
| 30 | + with: |
| 31 | + dotnet-version: 5.0.x |
| 32 | + - name: Create Release NuGet package |
| 33 | + run: | |
| 34 | + arrTag=(${GITHUB_REF//\// }) |
| 35 | + VERSION="${arrTag[2]}" |
| 36 | + echo Version: $VERSION |
| 37 | + CONFIGURATION=$([ "${VERSION:0:2}" == "v1" ] && echo "ReleaseV1" || echo "Release") |
| 38 | + VERSION="${VERSION//v}" |
| 39 | + echo Clean Version: $VERSION |
| 40 | + echo Configuration: $CONFIGURATION |
| 41 | + dotnet pack -v normal -c $CONFIGURATION --include-symbols --include-source -p:PackageVersion=$VERSION -o nupkg EntityFrameworkCore.Triggered.Core.slnf |
| 42 | + - name: Push to GitHub Feed |
| 43 | + run: | |
| 44 | + for f in ./nupkg/*.nupkg |
| 45 | + do |
| 46 | + dotnet nuget push $f --source $GITHUB_FEED --api-key ${{github.token}} --skip-duplicate --no-symbols true |
| 47 | + done |
| 48 | + - name: Push to NuGet Feed |
| 49 | + run: | |
| 50 | + for f in ./nupkg/*.nupkg |
| 51 | + do |
| 52 | + dotnet nuget push $f --source $NUGET_FEED --skip-duplicate --api-key $NUGET_KEY |
| 53 | + done |
0 commit comments