From 143cd1d6b46930ae5bb73aff7ae7ef6ffb74268c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Asbj=C3=B8rn=20Ulsberg?= Date: Fri, 25 Sep 2020 12:12:44 +0200 Subject: [PATCH 1/3] Rename setup.md to index.md in preparation for merge of content --- README.md | 87 ++----------------- .../azure/gitversion/{setup.md => index.md} | 0 .../github/gitversion/{setup.md => index.md} | 0 3 files changed, 8 insertions(+), 79 deletions(-) rename docs/examples/azure/gitversion/{setup.md => index.md} (100%) rename docs/examples/github/gitversion/{setup.md => index.md} (100%) diff --git a/README.md b/README.md index 563ed18..b78214b 100644 --- a/README.md +++ b/README.md @@ -12,87 +12,16 @@ GitHub Actions that allow to install and use the [GitVersion](https://github.com ## Usage -see examples of usages for **GitVersion**: +### GitVersion -- [GitHub Actions](docs/examples/github/gitversion) -- [Azure Pipeline tasks](docs/examples/azure/gitversion) +Examples for usage of **GitVersion**: -and for **GitReleaseManager**: +- [GitHub Actions](docs/examples/github/gitversion/) +- [Azure Pipeline tasks](docs/examples/azure/gitversion/) + +### GitReleaseManager + +Examples for usage of **GitReleaseManager**: - [GitHub Actions](docs/examples/github/gitreleasemanager) - [Azure Pipeline tasks](docs/examples/azure/gitreleasemanager) - -## Dependency - -There are two step dependencies that are required in your workflow before running this action. You must checkout your Git repository and then fetch the master branch and tags. - -```yaml - steps: - - name: Checkout - uses: actions/checkout@v2 - - name: Fetch all history for all tags and branches - run: git fetch --prune --unshallow -``` - -Basic: - -```yaml - steps: - - name: Checkout - uses: actions/checkout@v2 - - name: Fetch all history for all tags and branches - run: git fetch --prune --unshallow - - name: Install GitVersion - uses: gittools/actions/gitversion/setup@v0.9.2 - with: - versionSpec: '5.2.x' - - name: Use GitVersion - id: gitversion # step id used as reference for output values - uses: gittools/actions/gitversion/execute@v0.9.2 - - run: | - echo "Major: ${{ steps.gitversion.outputs.major }}" - echo "Minor: ${{ steps.gitversion.outputs.minor }}" - echo "Patch: ${{ steps.gitversion.outputs.patch }}" - echo "PreReleaseTag: ${{ steps.gitversion.outputs.preReleaseTag }}" - echo "PreReleaseTagWithDash: ${{ steps.gitversion.outputs.preReleaseTagWithDash }}" - echo "PreReleaseLabel: ${{ steps.gitversion.outputs.preReleaseLabel }}" - echo "PreReleaseNumber: ${{ steps.gitversion.outputs.preReleaseNumber }}" - echo "WeightedPreReleaseNumber: ${{ steps.gitversion.outputs.weightedPreReleaseNumber }}" - echo "BuildMetaData: ${{ steps.gitversion.outputs.buildMetaData }}" - echo "BuildMetaDataPadded: ${{ steps.gitversion.outputs.buildMetaDataPadded }}" - echo "FullBuildMetaData: ${{ steps.gitversion.outputs.fullBuildMetaData }}" - echo "MajorMinorPatch: ${{ steps.gitversion.outputs.majorMinorPatch }}" - echo "SemVer: ${{ steps.gitversion.outputs.semVer }}" - echo "LegacySemVer: ${{ steps.gitversion.outputs.legacySemVer }}" - echo "LegacySemVerPadded: ${{ steps.gitversion.outputs.legacySemVerPadded }}" - echo "AssemblySemVer: ${{ steps.gitversion.outputs.assemblySemVer }}" - echo "AssemblySemFileVer: ${{ steps.gitversion.outputs.assemblySemFileVer }}" - echo "FullSemVer: ${{ steps.gitversion.outputs.fullSemVer }}" - echo "InformationalVersion: ${{ steps.gitversion.outputs.informationalVersion }}" - echo "BranchName: ${{ steps.gitversion.outputs.branchName }}" - echo "Sha: ${{ steps.gitversion.outputs.sha }}" - echo "ShortSha: ${{ steps.gitversion.outputs.shortSha }}" - echo "NuGetVersionV2: ${{ steps.gitversion.outputs.nuGetVersionV2 }}" - echo "NuGetVersion: ${{ steps.gitversion.outputs.nuGetVersion }}" - echo "NuGetPreReleaseTagV2: ${{ steps.gitversion.outputs.nuGetPreReleaseTagV2 }}" - echo "NuGetPreReleaseTag: ${{ steps.gitversion.outputs.nuGetPreReleaseTag }}" - echo "VersionSourceSha: ${{ steps.gitversion.outputs.versionSourceSha }}" - echo "CommitsSinceVersionSource: ${{ steps.gitversion.outputs.commitsSinceVersionSource }}" - echo "CommitsSinceVersionSourcePadded: ${{ steps.gitversion.outputs.commitsSinceVersionSourcePadded }}" - echo "CommitDate: ${{ steps.gitversion.outputs.commitDate }}" - -``` - -### Private Repositories - -Private repos require credentials before you can fetch the master branch and tags. - -```yaml - steps: - - name: Checkout - uses: actions/checkout@v2 - - name: Fetch all history for all tags and branches - run: | - git config remote.origin.url https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }} - git fetch --prune --unshallow -``` diff --git a/docs/examples/azure/gitversion/setup.md b/docs/examples/azure/gitversion/index.md similarity index 100% rename from docs/examples/azure/gitversion/setup.md rename to docs/examples/azure/gitversion/index.md diff --git a/docs/examples/github/gitversion/setup.md b/docs/examples/github/gitversion/index.md similarity index 100% rename from docs/examples/github/gitversion/setup.md rename to docs/examples/github/gitversion/index.md From 79ec260c7bfb565a197e38a7d4197497d6fc3b8c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Asbj=C3=B8rn=20Ulsberg?= Date: Fri, 25 Sep 2020 12:14:30 +0200 Subject: [PATCH 2/3] Move content from execute.md into index.md --- docs/examples/azure/gitversion/execute.md | 10 ---------- docs/examples/azure/gitversion/index.md | 11 +++++++++++ docs/examples/github/gitversion/execute.md | 15 --------------- docs/examples/github/gitversion/index.md | 16 ++++++++++++++++ 4 files changed, 27 insertions(+), 25 deletions(-) delete mode 100644 docs/examples/azure/gitversion/execute.md delete mode 100644 docs/examples/github/gitversion/execute.md diff --git a/docs/examples/azure/gitversion/execute.md b/docs/examples/azure/gitversion/execute.md deleted file mode 100644 index 0413974..0000000 --- a/docs/examples/azure/gitversion/execute.md +++ /dev/null @@ -1,10 +0,0 @@ -# Example - -```yaml -steps: -- task: gitversion/execute@0 - displayName: Use GitVersion -- script: | - echo FullSemVer: $(fullSemVer) - echo ##vso[build.updatebuildnumber]$(fullSemVer) -``` diff --git a/docs/examples/azure/gitversion/index.md b/docs/examples/azure/gitversion/index.md index a8710e4..a448458 100644 --- a/docs/examples/azure/gitversion/index.md +++ b/docs/examples/azure/gitversion/index.md @@ -7,3 +7,14 @@ inputs: versionSpec: '5.1.3' ``` + +# Example + +```yaml +steps: +- task: gitversion/execute@0 + displayName: Use GitVersion +- script: | + echo FullSemVer: $(fullSemVer) + echo ##vso[build.updatebuildnumber]$(fullSemVer) +``` diff --git a/docs/examples/github/gitversion/execute.md b/docs/examples/github/gitversion/execute.md deleted file mode 100644 index ae1d04e..0000000 --- a/docs/examples/github/gitversion/execute.md +++ /dev/null @@ -1,15 +0,0 @@ -# Example - -```yaml - steps: - - name: Fetch all history for all tags and branches - run: git fetch --prune --unshallow - - name: Use GitVersion - id: gitversion # step id used as reference for output values - uses: gittools/actions/gitversion/execute@v0.9.2 - - run: | - echo "Major: ${{ steps.gitversion.outputs.major }}" - echo "Minor: ${{ steps.gitversion.outputs.minor }}" - echo "Patch: ${{ steps.gitversion.outputs.patch }}" - name: Output -``` diff --git a/docs/examples/github/gitversion/index.md b/docs/examples/github/gitversion/index.md index 5590ae5..902f398 100644 --- a/docs/examples/github/gitversion/index.md +++ b/docs/examples/github/gitversion/index.md @@ -9,3 +9,19 @@ with: versionSpec: '5.2.x' ``` + +# Example + +```yaml + steps: + - name: Fetch all history for all tags and branches + run: git fetch --prune --unshallow + - name: Use GitVersion + id: gitversion # step id used as reference for output values + uses: gittools/actions/gitversion/execute@v0.9.2 + - run: | + echo "Major: ${{ steps.gitversion.outputs.major }}" + echo "Minor: ${{ steps.gitversion.outputs.minor }}" + echo "Patch: ${{ steps.gitversion.outputs.patch }}" + name: Output +``` From 5d833b4a3094f16190b17aab1ea039393f8c168e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Asbj=C3=B8rn=20Ulsberg?= Date: Fri, 25 Sep 2020 12:17:26 +0200 Subject: [PATCH 3/3] Update GitVersion examples Bump the version number in the GitHub action example and make the AzDO example more complete. --- docs/examples/azure/gitversion/index.md | 45 ++++++++++++---- docs/examples/github/gitversion/index.md | 69 ++++++++++++++++-------- 2 files changed, 80 insertions(+), 34 deletions(-) diff --git a/docs/examples/azure/gitversion/index.md b/docs/examples/azure/gitversion/index.md index a448458..4dc42a2 100644 --- a/docs/examples/azure/gitversion/index.md +++ b/docs/examples/azure/gitversion/index.md @@ -6,15 +6,38 @@ displayName: Install GitVersion inputs: versionSpec: '5.1.3' -``` - -# Example - -```yaml -steps: -- task: gitversion/execute@0 - displayName: Use GitVersion -- script: | - echo FullSemVer: $(fullSemVer) - echo ##vso[build.updatebuildnumber]$(fullSemVer) + - task: gitversion/execute@0 + displayName: Use GitVersion + - script: | + echo FullSemVer: $(fullSemVer) + echo ##vso[build.updatebuildnumber]$(fullSemVer) + echo Major: ${{ steps.gitversion.outputs.major }} + echo Minor: ${{ steps.gitversion.outputs.minor }} + echo Patch: ${{ steps.gitversion.outputs.patch }} + echo PreReleaseTag: ${{ steps.gitversion.outputs.preReleaseTag }} + echo PreReleaseTagWithDash: ${{ steps.gitversion.outputs.preReleaseTagWithDash }} + echo PreReleaseLabel: ${{ steps.gitversion.outputs.preReleaseLabel }} + echo PreReleaseNumber: ${{ steps.gitversion.outputs.preReleaseNumber }} + echo WeightedPreReleaseNumber: ${{ steps.gitversion.outputs.weightedPreReleaseNumber }} + echo BuildMetaData: ${{ steps.gitversion.outputs.buildMetaData }} + echo BuildMetaDataPadded: ${{ steps.gitversion.outputs.buildMetaDataPadded }} + echo FullBuildMetaData: ${{ steps.gitversion.outputs.fullBuildMetaData }} + echo MajorMinorPatch: ${{ steps.gitversion.outputs.majorMinorPatch }} + echo SemVer: ${{ steps.gitversion.outputs.semVer }} + echo LegacySemVer: ${{ steps.gitversion.outputs.legacySemVer }} + echo LegacySemVerPadded: ${{ steps.gitversion.outputs.legacySemVerPadded }} + echo AssemblySemVer: ${{ steps.gitversion.outputs.assemblySemVer }} + echo AssemblySemFileVer: ${{ steps.gitversion.outputs.assemblySemFileVer }} + echo InformationalVersion: ${{ steps.gitversion.outputs.informationalVersion }} + echo BranchName: ${{ steps.gitversion.outputs.branchName }} + echo Sha: ${{ steps.gitversion.outputs.sha }} + echo ShortSha: ${{ steps.gitversion.outputs.shortSha }} + echo NuGetVersionV2: ${{ steps.gitversion.outputs.nuGetVersionV2 }} + echo NuGetVersion: ${{ steps.gitversion.outputs.nuGetVersion }} + echo NuGetPreReleaseTagV2: ${{ steps.gitversion.outputs.nuGetPreReleaseTagV2 }} + echo NuGetPreReleaseTag: ${{ steps.gitversion.outputs.nuGetPreReleaseTag }} + echo VersionSourceSha: ${{ steps.gitversion.outputs.versionSourceSha }} + echo CommitsSinceVersionSource: ${{ steps.gitversion.outputs.commitsSinceVersionSource }} + echo CommitsSinceVersionSourcePadded: ${{ steps.gitversion.outputs.commitsSinceVersionSourcePadded }} + echo CommitDate: ${{ steps.gitversion.outputs.commitDate }} ``` diff --git a/docs/examples/github/gitversion/index.md b/docs/examples/github/gitversion/index.md index 902f398..97992d5 100644 --- a/docs/examples/github/gitversion/index.md +++ b/docs/examples/github/gitversion/index.md @@ -1,27 +1,50 @@ -# Example +# GitVersion + +For the GitVersion workflow to execute successfully, you must checkout your Git +repository with `fetch-depth: 0` to fetch all history for all tags and branches. ```yaml - steps: - - name: Checkout - uses: actions/checkout@v2 - - name: Install GitVersion - uses: gittools/actions/gitversion/setup@v0.9.2 - with: + steps: + - name: Checkout + uses: actions/checkout@v2 + with: + fetch-depth: 0 + - name: Install GitVersion + uses: gittools/actions/gitversion/setup@v0.9.3 + with: versionSpec: '5.2.x' -``` - -# Example - -```yaml - steps: - - name: Fetch all history for all tags and branches - run: git fetch --prune --unshallow - - name: Use GitVersion - id: gitversion # step id used as reference for output values - uses: gittools/actions/gitversion/execute@v0.9.2 - - run: | - echo "Major: ${{ steps.gitversion.outputs.major }}" - echo "Minor: ${{ steps.gitversion.outputs.minor }}" - echo "Patch: ${{ steps.gitversion.outputs.patch }}" - name: Output + - name: Use GitVersion + id: gitversion # step id used as reference for output values + uses: gittools/actions/gitversion/execute@v0.9.3 + - run: | + echo "Major: ${{ steps.gitversion.outputs.major }}" + echo "Minor: ${{ steps.gitversion.outputs.minor }}" + echo "Patch: ${{ steps.gitversion.outputs.patch }}" + echo "PreReleaseTag: ${{ steps.gitversion.outputs.preReleaseTag }}" + echo "PreReleaseTagWithDash: ${{ steps.gitversion.outputs.preReleaseTagWithDash }}" + echo "PreReleaseLabel: ${{ steps.gitversion.outputs.preReleaseLabel }}" + echo "PreReleaseNumber: ${{ steps.gitversion.outputs.preReleaseNumber }}" + echo "WeightedPreReleaseNumber: ${{ steps.gitversion.outputs.weightedPreReleaseNumber }}" + echo "BuildMetaData: ${{ steps.gitversion.outputs.buildMetaData }}" + echo "BuildMetaDataPadded: ${{ steps.gitversion.outputs.buildMetaDataPadded }}" + echo "FullBuildMetaData: ${{ steps.gitversion.outputs.fullBuildMetaData }}" + echo "MajorMinorPatch: ${{ steps.gitversion.outputs.majorMinorPatch }}" + echo "SemVer: ${{ steps.gitversion.outputs.semVer }}" + echo "LegacySemVer: ${{ steps.gitversion.outputs.legacySemVer }}" + echo "LegacySemVerPadded: ${{ steps.gitversion.outputs.legacySemVerPadded }}" + echo "AssemblySemVer: ${{ steps.gitversion.outputs.assemblySemVer }}" + echo "AssemblySemFileVer: ${{ steps.gitversion.outputs.assemblySemFileVer }}" + echo "FullSemVer: ${{ steps.gitversion.outputs.fullSemVer }}" + echo "InformationalVersion: ${{ steps.gitversion.outputs.informationalVersion }}" + echo "BranchName: ${{ steps.gitversion.outputs.branchName }}" + echo "Sha: ${{ steps.gitversion.outputs.sha }}" + echo "ShortSha: ${{ steps.gitversion.outputs.shortSha }}" + echo "NuGetVersionV2: ${{ steps.gitversion.outputs.nuGetVersionV2 }}" + echo "NuGetVersion: ${{ steps.gitversion.outputs.nuGetVersion }}" + echo "NuGetPreReleaseTagV2: ${{ steps.gitversion.outputs.nuGetPreReleaseTagV2 }}" + echo "NuGetPreReleaseTag: ${{ steps.gitversion.outputs.nuGetPreReleaseTag }}" + echo "VersionSourceSha: ${{ steps.gitversion.outputs.versionSourceSha }}" + echo "CommitsSinceVersionSource: ${{ steps.gitversion.outputs.commitsSinceVersionSource }}" + echo "CommitsSinceVersionSourcePadded: ${{ steps.gitversion.outputs.commitsSinceVersionSourcePadded }}" + echo "CommitDate: ${{ steps.gitversion.outputs.commitDate }}" ```