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