|
| 1 | +# Release Upversion |
| 2 | +# Runs on release branch push (create method doesn't support ignoring tags yet) |
| 3 | +# Designed to run upversion and create a PR with the changes |
| 4 | +# |
| 5 | +# When the release is tagged and published, merge to stable |
| 6 | +# before deleting |
| 7 | +name: Release-Upversion-PR |
| 8 | + |
| 9 | +on: |
| 10 | + push: |
| 11 | + branches: |
| 12 | + - 'release/[0-9]+.[0-9]+.[0-9]+' # Only run on major.minor.patch releases |
| 13 | + |
| 14 | +permissions: |
| 15 | + contents: write |
| 16 | + pull-requests: write |
| 17 | + |
| 18 | +jobs: |
| 19 | + pre_job: |
| 20 | + name: Build Preparation |
| 21 | + runs-on: ubuntu-latest |
| 22 | + outputs: |
| 23 | + build_number: ${{ steps.gitversion.outputs.buildMetaData }} |
| 24 | + new_version: ${{ steps.gitversion.outputs.majorMinorPatch }} |
| 25 | + major: ${{ steps.gitversion.outputs.major }} |
| 26 | + minor: ${{ steps.gitversion.outputs.minor }} |
| 27 | + patch: ${{ steps.gitversion.outputs.patch }} |
| 28 | + steps: |
| 29 | + - uses: actions/checkout@v4 |
| 30 | + with: |
| 31 | + persist-credentials: false # otherwise, the token used is the GITHUB_TOKEN, instead of your personal token |
| 32 | + fetch-depth: 0 # Required due to the way Git works, without it this action won't be able to find any or the correct tags |
| 33 | + - name: Install GitVersion |
| 34 | + uses: gittools/actions/gitversion/[email protected] |
| 35 | + with: |
| 36 | + versionSpec: '5.x' |
| 37 | + - name: Determine Version |
| 38 | + id: gitversion |
| 39 | + uses: gittools/actions/gitversion/[email protected] |
| 40 | + - name: Get branch name |
| 41 | + id: branchname |
| 42 | + |
| 43 | + - name: Display GitVersion outputs |
| 44 | + run: | |
| 45 | + echo "Major: ${{ steps.gitversion.outputs.major }}" |
| 46 | + echo "Minor: ${{ steps.gitversion.outputs.minor }}" |
| 47 | + echo "Patch: ${{ steps.gitversion.outputs.patch }}" |
| 48 | + echo "PreReleaseTag: ${{ steps.gitversion.outputs.preReleaseTag }}" |
| 49 | + echo "PreReleaseTagWithDash: ${{ steps.gitversion.outputs.preReleaseTagWithDash }}" |
| 50 | + echo "PreReleaseLabel: ${{ steps.gitversion.outputs.preReleaseLabel }}" |
| 51 | + echo "PreReleaseNumber: ${{ steps.gitversion.outputs.preReleaseNumber }}" |
| 52 | + echo "WeightedPreReleaseNumber: ${{ steps.gitversion.outputs.weightedPreReleaseNumber }}" |
| 53 | + echo "BuildMetaData: ${{ steps.gitversion.outputs.buildMetaData }}" |
| 54 | + echo "BuildMetaDataPadded: ${{ steps.gitversion.outputs.buildMetaDataPadded }}" |
| 55 | + echo "FullBuildMetaData: ${{ steps.gitversion.outputs.fullBuildMetaData }}" |
| 56 | + echo "MajorMinorPatch: ${{ steps.gitversion.outputs.majorMinorPatch }}" |
| 57 | + echo "SemVer: ${{ steps.gitversion.outputs.semVer }}" |
| 58 | + echo "LegacySemVer: ${{ steps.gitversion.outputs.legacySemVer }}" |
| 59 | + echo "LegacySemVerPadded: ${{ steps.gitversion.outputs.legacySemVerPadded }}" |
| 60 | + echo "AssemblySemVer: ${{ steps.gitversion.outputs.assemblySemVer }}" |
| 61 | + echo "AssemblySemFileVer: ${{ steps.gitversion.outputs.assemblySemFileVer }}" |
| 62 | + echo "FullSemVer: ${{ steps.gitversion.outputs.fullSemVer }}" |
| 63 | + echo "InformationalVersion: ${{ steps.gitversion.outputs.informationalVersion }}" |
| 64 | + echo "BranchName: ${{ steps.gitversion.outputs.branchName }}" |
| 65 | + echo "EscapedBranchName: ${{ steps.gitversion.outputs.escapedBranchName }}" |
| 66 | + echo "Sha: ${{ steps.gitversion.outputs.sha }}" |
| 67 | + echo "ShortSha: ${{ steps.gitversion.outputs.shortSha }}" |
| 68 | + echo "NuGetVersionV2: ${{ steps.gitversion.outputs.nuGetVersionV2 }}" |
| 69 | + echo "NuGetVersion: ${{ steps.gitversion.outputs.nuGetVersion }}" |
| 70 | + echo "NuGetPreReleaseTagV2: ${{ steps.gitversion.outputs.nuGetPreReleaseTagV2 }}" |
| 71 | + echo "NuGetPreReleaseTag: ${{ steps.gitversion.outputs.nuGetPreReleaseTag }}" |
| 72 | + echo "VersionSourceSha: ${{ steps.gitversion.outputs.versionSourceSha }}" |
| 73 | + echo "CommitsSinceVersionSource: ${{ steps.gitversion.outputs.commitsSinceVersionSource }}" |
| 74 | + echo "CommitsSinceVersionSourcePadded: ${{ steps.gitversion.outputs.commitsSinceVersionSourcePadded }}" |
| 75 | + echo "UncommittedChanges: ${{ steps.gitversion.outputs.uncommittedChanges }}" |
| 76 | + echo "CommitDate: ${{ steps.gitversion.outputs.commitDate }}" |
| 77 | + upversion-and-pr: |
| 78 | + name: Upversion and PR |
| 79 | + needs: pre_job |
| 80 | + runs-on: windows-latest |
| 81 | + env: |
| 82 | + build_number: ${{ needs.pre_job.outputs.build_number }} |
| 83 | + new_version: ${{ needs.pre_job.outputs.new_version }} |
| 84 | + steps: |
| 85 | + - uses: actions/checkout@v4 |
| 86 | + - name: Run Upversion |
| 87 | + id: upversion |
| 88 | + shell: pwsh |
| 89 | + run: | |
| 90 | + .\tools\upversion\upversion.ps1 |
| 91 | + env: |
| 92 | + MAJORVERSION: ${{ needs.pre_job.outputs.major }} |
| 93 | + MINORVERSION: ${{ needs.pre_job.outputs.minor }} |
| 94 | + PATCHVERSION: ${{ needs.pre_job.outputs.patch }} |
| 95 | + - name: Create Pull Request |
| 96 | + uses: peter-evans/create-pull-request@v7 |
| 97 | + with: |
| 98 | + commit-message: upversion to version ${{env.new_version}} |
| 99 | + title: Upversion release branch to ${{env.new_version}} |
| 100 | + body: | |
| 101 | + This PR covers the task of upversioning the release branch to its intended version. |
| 102 | + After accepting this PR, you may publish the release after verifying the artifacts. |
0 commit comments