|
| 1 | +name: build |
| 2 | +on: |
| 3 | + push: |
| 4 | + pull_request: |
| 5 | + release: |
| 6 | + types: |
| 7 | + - published |
| 8 | +env: |
| 9 | + # Stop wasting time caching packages |
| 10 | + DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true |
| 11 | + # Disable sending usage data to Microsoft |
| 12 | + DOTNET_CLI_TELEMETRY_OPTOUT: true |
| 13 | + # Project name to pack and publish |
| 14 | + PROJECT_NAME: eskv |
| 15 | + # GitHub Packages Feed settings |
| 16 | + GITHUB_FEED: https://nuget.pkg.github.com/thinkbeforecoding/ |
| 17 | + GITHUB_USER: thinkbeforecoding |
| 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_API_KEY }} |
| 22 | +jobs: |
| 23 | + build: |
| 24 | + runs-on: ${{ matrix.os }} |
| 25 | + strategy: |
| 26 | + matrix: |
| 27 | + os: [ ubuntu-latest ] |
| 28 | + steps: |
| 29 | + - name: Checkout |
| 30 | + uses: actions/checkout@v2 |
| 31 | + with: |
| 32 | + fetch-depth: 0 |
| 33 | + - name: Setup .NET Core |
| 34 | + uses: actions/setup-dotnet@v1 |
| 35 | + with: |
| 36 | + dotnet-version: 7.0.x |
| 37 | + - name: Build |
| 38 | + run: ./build.ps1 |
| 39 | + - name: Upload Artifact |
| 40 | + if: matrix.os == 'ubuntu-latest' |
| 41 | + uses: actions/upload-artifact@v2 |
| 42 | + with: |
| 43 | + name: nupkg |
| 44 | + path: ./bin/nuget/*.nupkg |
| 45 | + prerelease: |
| 46 | + needs: build |
| 47 | + if: github.ref == 'refs/heads/dev' |
| 48 | + runs-on: ubuntu-latest |
| 49 | + steps: |
| 50 | + - name: Download Artifact |
| 51 | + uses: actions/download-artifact@v1 |
| 52 | + with: |
| 53 | + name: nupkg |
| 54 | + - name: Push to GitHub Feed |
| 55 | + run: | |
| 56 | + for f in ./bin/nuget/*.nupkg |
| 57 | + do |
| 58 | + curl -vX PUT -u "$GITHUB_USER:$GITHUB_TOKEN" -F package=@$f $GITHUB_FEED |
| 59 | + done |
| 60 | + deploy: |
| 61 | + needs: build |
| 62 | + if: github.event_name == 'release' |
| 63 | + runs-on: ubuntu-latest |
| 64 | + steps: |
| 65 | + - uses: actions/checkout@v2 |
| 66 | + with: |
| 67 | + fetch-depth: 0 |
| 68 | + - name: Setup .NET Core |
| 69 | + uses: actions/setup-dotnet@v1 |
| 70 | + with: |
| 71 | + dotnet-version: 7.0.x |
| 72 | + include-prerelease: true |
| 73 | + - name: Build |
| 74 | + run: ./build.ps1 |
| 75 | + |
| 76 | + - name: Push to GitHub Feed |
| 77 | + run: | |
| 78 | + for f in ./bin/nuget/*.nupkg |
| 79 | + do |
| 80 | + curl -vX PUT -u "$GITHUB_USER:$GITHUB_TOKEN" -F package=@$f $GITHUB_FEED |
| 81 | + done |
| 82 | + - name: Push to NuGet Feed |
| 83 | + run: dotnet nuget push ./bin/nuget/*.nupkg --source $NUGET_FEED --skip-duplicate --api-key $NUGET_KEY |
0 commit comments