|
| 1 | +name: Master workflow |
| 2 | +on: |
| 3 | + push: |
| 4 | + branches: |
| 5 | + - master |
| 6 | + - 'release/**' |
| 7 | + - 'releases/**' |
| 8 | + tags: |
| 9 | + - v* |
| 10 | + - V* |
| 11 | +env: |
| 12 | + DOTNET_CLI_TELEMETRY_OPTOUT: true |
| 13 | + MSBUILDSINGLELOADCONTEXT: 1 |
| 14 | +jobs: |
| 15 | + generateVersionInfo: |
| 16 | + name: GenerateVersionInfo |
| 17 | + runs-on: ubuntu-latest |
| 18 | + steps: |
| 19 | + - name: Checkout |
| 20 | + uses: actions/checkout@v2 |
| 21 | + with: |
| 22 | + fetch-depth: 0 |
| 23 | + - name: Restore dotnet tools |
| 24 | + run: dotnet tool restore |
| 25 | + - name: Fetch complete repository including tags |
| 26 | + run: git fetch --tags --force --prune |
| 27 | + - name: Generate version info from git history |
| 28 | + run: dotnet gitversion /output json | jq -r 'to_entries|map("GitVersion_\(.key)=\(.value|tostring)")|.[]' >> gitversion.env && cat gitversion.env |
| 29 | + - name: Upload version info file |
| 30 | + uses: actions/upload-artifact@v1 |
| 31 | + with: |
| 32 | + name: gitversion |
| 33 | + path: gitversion.env |
| 34 | + |
| 35 | + build: |
| 36 | + name: Build |
| 37 | + needs: generateVersionInfo |
| 38 | + runs-on: ubuntu-latest |
| 39 | + steps: |
| 40 | + - name: Checkout |
| 41 | + uses: actions/checkout@v2 |
| 42 | + - name: Download version info file |
| 43 | + uses: actions/download-artifact@v1 |
| 44 | + with: |
| 45 | + name: gitversion |
| 46 | + path: ./ |
| 47 | + - name: Inject version info into environment |
| 48 | + run: cat ./gitversion.env >> $GITHUB_ENV |
| 49 | + - name: Build solution |
| 50 | + run: echo "Current version is \"$GitVersion_SemVer\"" && dotnet build -c Release |
| 51 | + - name: Create NuGet packages |
| 52 | + run: dotnet pack -c Release --no-build -o nupkg |
| 53 | + - name: Upload nuget packages |
| 54 | + uses: actions/upload-artifact@v1 |
| 55 | + with: |
| 56 | + name: nupkg |
| 57 | + path: nupkg |
| 58 | + |
| 59 | + test: |
| 60 | + name: Test |
| 61 | + needs: [build, generateVersionInfo] |
| 62 | + runs-on: ubuntu-latest |
| 63 | + steps: |
| 64 | + - name: Checkout |
| 65 | + uses: actions/checkout@v2 |
| 66 | + - name: Download version info file |
| 67 | + uses: actions/download-artifact@v1 |
| 68 | + with: |
| 69 | + name: gitversion |
| 70 | + path: ./ |
| 71 | + - name: Inject version info into environment |
| 72 | + run: cat ./gitversion.env >> $GITHUB_ENV |
| 73 | + - name: Run tests |
| 74 | + run: echo "Current version is \"$GitVersion_SemVer\"" && dotnet test -c Release |
0 commit comments