|
1 | 1 | name: .NET Core
|
2 | 2 |
|
| 3 | +env: |
| 4 | + # Stop wasting time caching packages |
| 5 | + DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true |
| 6 | + # Disable sending usage data to Microsoft |
| 7 | + DOTNET_CLI_TELEMETRY_OPTOUT: true |
| 8 | + # GitHub Packages Feed settings |
| 9 | + GITHUB_FEED: https://nuget.pkg.github.com/fsprojects |
| 10 | + GITHUB_USER: fsprojects |
| 11 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 12 | + |
3 | 13 | on:
|
4 | 14 | push:
|
5 | 15 | branches: [ master ]
|
6 | 16 | pull_request:
|
7 | 17 | branches: [ master ]
|
8 |
| - |
9 | 18 | jobs:
|
10 | 19 | build:
|
11 | 20 |
|
|
24 | 33 | - name: Test with dotnet
|
25 | 34 | run: dotnet test build.proj -v n
|
26 | 35 |
|
| 36 | + package: |
| 37 | + runs-on: windows-latest |
| 38 | + |
| 39 | + steps: |
| 40 | + - uses: actions/checkout@v2 |
| 41 | + - name: Setup .NET Core |
| 42 | + uses: actions/setup-dotnet@v1 |
| 43 | + with: |
| 44 | + dotnet-version: 6.0.201 |
| 45 | + - name: Restore |
| 46 | + run: git submodule update --init --recursive |
| 47 | + |
| 48 | + - name: Extract branch name |
| 49 | + shell: bash |
| 50 | + run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})" |
| 51 | + id: extract_branch |
| 52 | + - name: Setup Version Suffix |
| 53 | + shell: pwsh |
| 54 | + run: | |
| 55 | + $buildId = $env:GITHUB_RUN_NUMBER.PadLeft(5, '0'); |
| 56 | + $versionSuffixPR = "PR${{ github.event.pull_request.number }}-$buildId"; |
| 57 | + $branchName = "${{ steps.extract_branch.outputs.branch }}".Replace("_","").Replace("/","-"); |
| 58 | + $versionSuffixBRANCH = "$($branchName)-CI$($buildId)" |
| 59 | + $env:VersionSuffix = if ("${{ github.event.pull_request.number }}") { $versionSuffixPR } else { $versionSuffixBRANCH } |
| 60 | + Write-Output "##[set-output name=version_suffix]$($env:VersionSuffix)" |
| 61 | + id: version_suffix |
| 62 | + - name: Package |
| 63 | + run: dotnet pack build.proj --version-suffix ${{ steps.version_suffix.outputs.version_suffix }} |
| 64 | + - name: Upload Artifacts |
| 65 | + uses: actions/upload-artifact@v2 |
| 66 | + with: |
| 67 | + name: nupkg |
| 68 | + path: ./bin/nupkg/*.nupkg |
| 69 | + - name: Push to GitHub Feed |
| 70 | + shell: bash |
| 71 | + run: | |
| 72 | + for f in ./bin/nupkg/*.nupkg |
| 73 | + do |
| 74 | + curl -vX PUT -u "$GITHUB_USER:$GITHUB_TOKEN" -F package=@$f $GITHUB_FEED |
| 75 | + done |
| 76 | +
|
27 | 77 | docs:
|
28 | 78 | runs-on: windows-latest
|
29 | 79 | steps:
|
|
0 commit comments