|
| 1 | +name: 'Build with .NET CLI' |
| 2 | +author: 'Pete Sramek' |
| 3 | +description: 'Compiles source code, uploads build artifacts.' |
| 4 | +inputs: |
| 5 | +# Required |
| 6 | + config-file-path: |
| 7 | + description: 'Path to the configuration file.' |
| 8 | + required: true |
| 9 | + run-number: |
| 10 | + description: 'The run number of the parent workflow.' |
| 11 | + required: true |
| 12 | +# Optional |
| 13 | + dotnet-sdk-version: |
| 14 | + description: 'Version of the .NET SDK to use. Default: ''9.0.x''.' |
| 15 | + required: false |
| 16 | + default: '9.0.x' |
| 17 | + gitversion-version: |
| 18 | + description: 'Version of GitVersion to use. Default: ''6.1.x''.' |
| 19 | + required: false |
| 20 | + default: '6.1.x' |
| 21 | + prerelease-tag: |
| 22 | + description: 'The prerelease tag to use. Default: ''''.' |
| 23 | + required: false |
| 24 | + default: '' |
| 25 | +outputs: |
| 26 | + friendly-version: |
| 27 | + description: "The friedly version." |
| 28 | + value: ${{ jobs.version.outputs.friendly-version }} |
| 29 | + assembly-version: |
| 30 | + description: "The assembly version." |
| 31 | + value: ${{ jobs.version.outputs.assembly-version }} |
| 32 | + assembly-informational-version: |
| 33 | + description: "The assembly informational version." |
| 34 | + value: ${{ jobs.version.outputs.assembly-informational-version }} |
| 35 | + file-version: |
| 36 | + description: "The file version." |
| 37 | + value: ${{ jobs.version.outputs.file-version }} |
| 38 | + package-version: |
| 39 | + description: "The package version." |
| 40 | + value: ${{ jobs.version.outputs.package-version }} |
| 41 | + |
| 42 | +runs: |
| 43 | + using: "composite" |
| 44 | + steps: |
| 45 | + |
| 46 | + - name: 'Checkout ${{ github.head_ref || github.ref }}' |
| 47 | + uses: actions/checkout@v4 |
| 48 | + with: |
| 49 | + fetch-depth: 0 |
| 50 | + |
| 51 | + - name: 'Setup GitVersion ${{ env.git-version }}' |
| 52 | + uses: gittools/actions/gitversion/setup@v4.1.0 |
| 53 | + with: |
| 54 | + versionSpec: ${{ inputs.gitversion-version }} |
| 55 | + preferLatestVersion: true |
| 56 | + |
| 57 | + - name: 'Determine version' |
| 58 | + id: gitversion |
| 59 | + uses: gittools/actions/gitversion/execute@v4.1.0 |
| 60 | + with: |
| 61 | + configFilePath: ${{ inputs.config-file-path }} |
| 62 | + |
| 63 | + - name: 'Set friendly version' |
| 64 | + shell: bash |
| 65 | + run: echo "friendly-version=${{ steps.gitversion.outputs.assemblySemVer }}" >> $GITHUB_ENV |
| 66 | + |
| 67 | + - name: 'Set assembly version' |
| 68 | + shell: bash |
| 69 | + run: echo "assembly-version=${{ steps.gitversion.outputs.assemblySemVer }}.${{ inputs.run-number }}.${{ steps.gitversion.outputs.CommitsSinceVersionSource }}" >> $GITHUB_ENV |
| 70 | + |
| 71 | + - name: 'Set assembly informational version' |
| 72 | + shell: bash |
| 73 | + run: echo "assembly-informational-version=${{ steps.gitversion.outputs.assemblySemVer }}.${{ inputs.run-number }}+${{ steps.gitversion.outputs.sha }}" >> $GITHUB_ENV |
| 74 | + |
| 75 | + - name: 'Set file version' |
| 76 | + shell: bash |
| 77 | + run: echo "file-version=${{ steps.gitversion.outputs.AssemblySemFileVer }}.${{ inputs.run-number }}.${{ steps.gitversion.outputs.CommitsSinceVersionSource }}" >> $GITHUB_ENV |
| 78 | + |
| 79 | + - if: ${{ steps.gitversion.outputs.PreReleaseLabelWithDash == '' }} |
| 80 | + name: 'Set package version' |
| 81 | + shell: bash |
| 82 | + run: echo "package-version=${{ steps.gitversion.outputs.AssemblySemVer }}.${{ inputs.run-number }}" >> $GITHUB_ENV |
| 83 | + |
| 84 | + - if: ${{ steps.gitversion.outputs.PreReleaseLabelWithDash != '' }} |
| 85 | + name: 'Set package version' |
| 86 | + shell: bash |
| 87 | + run: echo "package-version=${{ steps.gitversion.outputs.AssemblySemVer }}.${{ inputs.run-number }}-${{ steps.gitversion.outputs.PreReleaseLabel }}-${{ steps.gitversion.outputs.CommitsSinceVersionSource }}" >> $GITHUB_ENV |
0 commit comments