add example workflow that updates to latest version the tasks/actions #20
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: different-job | |
on: [ push, pull_request, workflow_dispatch ] | |
jobs: | |
GitVersion_v6_Job: | |
name: GitVersion v6 Job | |
runs-on: ubuntu-latest | |
outputs: | |
branchName: ${{ steps.version_step.outputs.branchName }} | |
major: ${{ steps.version_step.outputs.major }} | |
minor: ${{ steps.version_step.outputs.minor }} | |
patch: ${{ steps.version_step.outputs.patch }} | |
semVer: ${{ steps.version_step.outputs.semVer }} | |
fullSemVer: ${{ steps.version_step.outputs.fullSemVer }} | |
GitVersion_BranchName: ${{ steps.version_step.outputs.GitVersion_BranchName }} | |
GitVersion_Major: ${{ steps.version_step.outputs.GitVersion_Major }} | |
GitVersion_Minor: ${{ steps.version_step.outputs.GitVersion_Minor }} | |
GitVersion_Patch: ${{ steps.version_step.outputs.GitVersion_Patch }} | |
GitVersion_SemVer: ${{ steps.version_step.outputs.GitVersion_SemVer }} | |
GitVersion_FullSemVer: ${{ steps.version_step.outputs.GitVersion_FullSemVer }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- uses: gittools/actions/gitversion/[email protected] | |
name: Install GitVersion | |
with: | |
versionSpec: '6.x' | |
includePrerelease: false | |
- uses: gittools/actions/gitversion/[email protected] | |
name: Use GitVersion | |
with: | |
useConfigFile: true | |
configFilePath: 'GitVersion_v6.yml' | |
overrideConfig: | | |
update-build-number=false | |
id: version_step # step id used as reference for output values | |
Use_GitVersion_v6_without_prefix: | |
name: Use Output from previous job (without prefix) | |
runs-on: windows-latest | |
needs: [ GitVersion_v6_Job ] | |
if: contains(needs.GitVersion_v6_Job.outputs['branchName'], 'main') | |
env: | |
myvar_major: ${{ needs.GitVersion_v6_Job.outputs.major }} | |
myvar_minor: ${{ needs.GitVersion_v6_Job.outputs.minor }} | |
myvar_patch: ${{ needs.GitVersion_v6_Job.outputs.patch }} | |
myvar_semVer: ${{ needs.GitVersion_v6_Job.outputs.semVer }} | |
myvar_fullSemVer: ${{ needs.GitVersion_v6_Job.outputs.fullSemVer }} | |
steps: | |
- run: | | |
echo "Major (env:myvar_major) : $env:myvar_major" | |
echo "Minor (env:myvar_minor) : $env:myvar_minor" | |
echo "Patch (env:myvar_patch) : $env:myvar_patch" | |
echo "SemVer (env:myvar_semVer) : $env:myvar_semVer" | |
echo "FullSemVer (env:myvar_fullSemVer) : $env:myvar_fullSemVer" | |
name: Use job variables (pwsh - outputs without prefix) | |
shell: pwsh | |
- run: | | |
echo "Major (env:localvar_major): $env:localvar_major" | |
echo "Minor (env:localvar_minor): $env:localvar_minor" | |
echo "Patch (env:localvar_patch): $env:localvar_patch" | |
echo "SemVer (env:localvar_semVer): $env:localvar_semVer" | |
echo "FullSemVer (env:localvar_fullSemVer): $env:localvar_fullSemVer" | |
name: Use local env mapped from output (pwsh - outputs without prefix) | |
shell: pwsh | |
env: | |
localvar_major: ${{ needs.GitVersion_v6_Job.outputs.major }} | |
localvar_minor: ${{ needs.GitVersion_v6_Job.outputs.minor }} | |
localvar_patch: ${{ needs.GitVersion_v6_Job.outputs.patch }} | |
localvar_semVer: ${{ needs.GitVersion_v6_Job.outputs.semVer }} | |
localvar_fullSemVer: ${{ needs.GitVersion_v6_Job.outputs.fullSemVer }} | |
- run: | | |
echo "Major (env:localvar_major) : $env:localvar_major" | |
echo "Minor (env:localvar_minor) : $env:localvar_minor" | |
echo "Patch (env:localvar_patch) : $env:localvar_patch" | |
echo "SemVer (env:localvar_semVer) : $env:localvar_semVer" | |
echo "FullSemVer (env:localvar_fullSemVer) : $env:localvar_fullSemVer" | |
name: Use local env mapped from job variables (pwsh - outputs without prefix) | |
shell: pwsh | |
env: | |
localvar_major: ${{ env.myvar_major }} | |
localvar_minor: ${{ env.myvar_minor }} | |
localvar_patch: ${{ env.myvar_patch }} | |
localvar_semVer: ${{ env.myvar_semVer }} | |
localvar_fullSemVer: ${{ env.myvar_fullSemVer }} | |
- run: | | |
echo "Major (needs.GitVersion_v6_Job.outputs.major) : ${{ needs.GitVersion_v6_Job.outputs.major }}" | |
echo "Minor (needs.GitVersion_v6_Job.outputs.minor) : ${{ needs.GitVersion_v6_Job.outputs.minor }}" | |
echo "Patch (needs.GitVersion_v6_Job.outputs.patch) : ${{ needs.GitVersion_v6_Job.outputs.patch }}" | |
echo "SemVer (needs.GitVersion_v6_Job.outputs.semVer) : ${{ needs.GitVersion_v6_Job.outputs.semVer }}" | |
echo "FullSemVer (needs.GitVersion_v6_Job.outputs.fullSemVer) : ${{ needs.GitVersion_v6_Job.outputs.fullSemVer }}" | |
name: Use direct output from previous job (pwsh - outputs without prefix) | |
shell: pwsh | |
- run: | | |
echo "Major (myvar_major) : $myvar_major" | |
echo "Minor (myvar_minor) : $myvar_minor" | |
echo "Patch (myvar_patch) : $myvar_patch" | |
echo "SemVer (myvar_semVer) : $myvar_semVer" | |
echo "FullSemVer (myvar_fullSemVer) : $myvar_fullSemVer" | |
name: Use job variables (bash - outputs without prefix) | |
shell: bash | |
- run: | | |
echo "Major (localvar_major): $localvar_major" | |
echo "Minor (localvar_minor): $localvar_minor" | |
echo "Patch (localvar_patch): $localvar_patch" | |
echo "SemVer (localvar_semVer): $localvar_semVer" | |
echo "FullSemVer (localvar_fullSemVer): $localvar_fullSemVer" | |
name: Use local env mapped from output (bash - outputs without prefix) | |
shell: bash | |
env: | |
localvar_major: ${{ needs.GitVersion_v6_Job.outputs.major }} | |
localvar_minor: ${{ needs.GitVersion_v6_Job.outputs.minor }} | |
localvar_patch: ${{ needs.GitVersion_v6_Job.outputs.patch }} | |
localvar_semVer: ${{ needs.GitVersion_v6_Job.outputs.semVer }} | |
localvar_fullSemVer: ${{ needs.GitVersion_v6_Job.outputs.fullSemVer }} | |
- run: | | |
echo "Major (localvar_major) : $localvar_major" | |
echo "Minor (localvar_minor) : $localvar_minor" | |
echo "Patch (localvar_patch) : $localvar_patch" | |
echo "SemVer (localvar_semVer) : $localvar_semVer" | |
echo "FullSemVer (localvar_fullSemVer) : $localvar_fullSemVer" | |
name: Use local env mapped from job variables (bash - outputs without prefix) | |
shell: bash | |
env: | |
localvar_major: ${{ env.myvar_major }} | |
localvar_minor: ${{ env.myvar_minor }} | |
localvar_patch: ${{ env.myvar_patch }} | |
localvar_semVer: ${{ env.myvar_semVer }} | |
localvar_fullSemVer: ${{ env.myvar_fullSemVer }} | |
- run: | | |
echo "Major (needs.GitVersion_v6_Job.outputs.major) : ${{ needs.GitVersion_v6_Job.outputs.major }}" | |
echo "Minor (needs.GitVersion_v6_Job.outputs.minor) : ${{ needs.GitVersion_v6_Job.outputs.minor }}" | |
echo "Patch (needs.GitVersion_v6_Job.outputs.patch) : ${{ needs.GitVersion_v6_Job.outputs.patch }}" | |
echo "SemVer (needs.GitVersion_v6_Job.outputs.semVer) : ${{ needs.GitVersion_v6_Job.outputs.semVer }}" | |
echo "FullSemVer (needs.GitVersion_v6_Job.outputs.fullSemVer) : ${{ needs.GitVersion_v6_Job.outputs.fullSemVer }}" | |
name: Use direct output from previous job (bash - outputs without prefix) | |
shell: bash | |
Use_GitVersion_v6_with_prefix: | |
name: Use Output from previous job (with prefix) | |
runs-on: windows-latest | |
needs: [ GitVersion_v6_Job ] | |
if: contains(needs.GitVersion_v6_Job.outputs['GitVersion_BranchName'], 'main') | |
env: | |
myvar_GitVersion_Major: ${{ needs.GitVersion_v6_Job.outputs.GitVersion_Major }} | |
myvar_GitVersion_Minor: ${{ needs.GitVersion_v6_Job.outputs.GitVersion_Minor }} | |
myvar_GitVersion_Patch: ${{ needs.GitVersion_v6_Job.outputs.GitVersion_Patch }} | |
myvar_GitVersion_SemVer: ${{ needs.GitVersion_v6_Job.outputs.GitVersion_SemVer }} | |
myvar_GitVersion_FullSemVer: ${{ needs.GitVersion_v6_Job.outputs.GitVersion_FullSemVer }} | |
steps: | |
- run: | | |
echo "Major (env:myvar_GitVersion_Major) : $env:myvar_GitVersion_Major" | |
echo "Minor (env:myvar_GitVersion_Minor) : $env:myvar_GitVersion_Minor" | |
echo "Patch (env:myvar_GitVersion_Patch) : $env:myvar_GitVersion_Patch" | |
echo "SemVer (env:myvar_GitVersion_SemVer) : $env:myvar_GitVersion_SemVer" | |
echo "FullSemVer (env:myvar_GitVersion_FullSemVer) : $env:myvar_GitVersion_FullSemVer" | |
name: Use job variables (pwsh - outputs with prefix) | |
shell: pwsh | |
- run: | | |
echo "Major (env:localvar_major): $env:localvar_major" | |
echo "Minor (env:localvar_minor): $env:localvar_minor" | |
echo "Patch (env:localvar_patch): $env:localvar_patch" | |
echo "SemVer (env:localvar_semVer): $env:localvar_semVer" | |
echo "FullSemVer (env:localvar_fullSemVer): $env:localvar_fullSemVer" | |
name: Use local env mapped from output (pwsh - outputs with prefix) | |
shell: pwsh | |
env: | |
localvar_major: ${{ needs.GitVersion_v6_Job.outputs.GitVersion_Major }} | |
localvar_minor: ${{ needs.GitVersion_v6_Job.outputs.GitVersion_Minor }} | |
localvar_patch: ${{ needs.GitVersion_v6_Job.outputs.GitVersion_Patch }} | |
localvar_semVer: ${{ needs.GitVersion_v6_Job.outputs.GitVersion_SemVer }} | |
localvar_fullSemVer: ${{ needs.GitVersion_v6_Job.outputs.GitVersion_FullSemVer }} | |
- run: | | |
echo "Major (env:localvar_major) : $env:localvar_major" | |
echo "Minor (env:localvar_minor) : $env:localvar_minor" | |
echo "Patch (env:localvar_patch) : $env:localvar_patch" | |
echo "SemVer (env:localvar_semVer) : $env:localvar_semVer" | |
echo "FullSemVer (env:localvar_fullSemVer) : $env:localvar_fullSemVer" | |
name: Use local env mapped from job variables (pwsh - outputs with prefix) | |
shell: pwsh | |
env: | |
localvar_major: ${{ env.myvar_GitVersion_Major }} | |
localvar_minor: ${{ env.myvar_GitVersion_Minor }} | |
localvar_patch: ${{ env.myvar_GitVersion_Patch }} | |
localvar_semVer: ${{ env.myvar_GitVersion_SemVer }} | |
localvar_fullSemVer: ${{ env.myvar_GitVersion_FullSemVer }} | |
- run: | | |
echo "Major (needs.GitVersion_v6_Job.outputs.GitVersion_Major) : ${{ needs.GitVersion_v6_Job.outputs.GitVersion_Major }}" | |
echo "Minor (needs.GitVersion_v6_Job.outputs.GitVersion_Minor) : ${{ needs.GitVersion_v6_Job.outputs.GitVersion_Minor }}" | |
echo "Patch (needs.GitVersion_v6_Job.outputs.GitVersion_Patch) : ${{ needs.GitVersion_v6_Job.outputs.GitVersion_Patch }}" | |
echo "SemVer (needs.GitVersion_v6_Job.outputs.GitVersion_SemVer) : ${{ needs.GitVersion_v6_Job.outputs.GitVersion_SemVer }}" | |
echo "FullSemVer (needs.GitVersion_v6_Job.outputs.GitVersion_FullSemVer) : ${{ needs.GitVersion_v6_Job.outputs.GitVersion_FullSemVer }}" | |
name: Use direct output from previous job (pwsh - outputs with prefix) | |
shell: pwsh | |
- run: | | |
echo "Major (myvar_GitVersion_Major) : $myvar_GitVersion_Major" | |
echo "Minor (myvar_GitVersion_Minor) : $myvar_GitVersion_Minor" | |
echo "Patch (myvar_GitVersion_Patch) : $myvar_GitVersion_Patch" | |
echo "SemVer (myvar_GitVersion_SemVer) : $myvar_GitVersion_SemVer" | |
echo "FullSemVer (myvar_GitVersion_FullSemVer) : $myvar_GitVersion_FullSemVer" | |
name: Use job variables (bash - outputs with prefix) | |
shell: bash | |
- run: | | |
echo "Major (localvar_major): $localvar_major" | |
echo "Minor (localvar_minor): $localvar_minor" | |
echo "Patch (localvar_patch): $localvar_patch" | |
echo "SemVer (localvar_semVer): $localvar_semVer" | |
echo "FullSemVer (localvar_fullSemVer): $localvar_fullSemVer" | |
name: Use local env mapped from output (bash - outputs with prefix) | |
shell: bash | |
env: | |
localvar_major: ${{ needs.GitVersion_v6_Job.outputs.GitVersion_Major }} | |
localvar_minor: ${{ needs.GitVersion_v6_Job.outputs.GitVersion_Minor }} | |
localvar_patch: ${{ needs.GitVersion_v6_Job.outputs.GitVersion_Patch }} | |
localvar_semVer: ${{ needs.GitVersion_v6_Job.outputs.GitVersion_SemVer }} | |
localvar_fullSemVer: ${{ needs.GitVersion_v6_Job.outputs.GitVersion_FullSemVer }} | |
- run: | | |
echo "Major (localvar_major) : $localvar_major" | |
echo "Minor (localvar_minor) : $localvar_minor" | |
echo "Patch (localvar_patch) : $localvar_patch" | |
echo "SemVer (localvar_semVer) : $localvar_semVer" | |
echo "FullSemVer (localvar_fullSemVer) : $localvar_fullSemVer" | |
name: Use local env mapped from job variables (bash - outputs with prefix) | |
shell: bash | |
env: | |
localvar_major: ${{ env.myvar_GitVersion_Major }} | |
localvar_minor: ${{ env.myvar_GitVersion_Minor }} | |
localvar_patch: ${{ env.myvar_GitVersion_Patch }} | |
localvar_semVer: ${{ env.myvar_GitVersion_SemVer }} | |
localvar_fullSemVer: ${{ env.myvar_GitVersion_FullSemVer }} | |
- run: | | |
echo "Major (needs.GitVersion_v6_Job.outputs.GitVersion_Major) : ${{ needs.GitVersion_v6_Job.outputs.GitVersion_Major }}" | |
echo "Minor (needs.GitVersion_v6_Job.outputs.GitVersion_Minor) : ${{ needs.GitVersion_v6_Job.outputs.GitVersion_Minor }}" | |
echo "Patch (needs.GitVersion_v6_Job.outputs.GitVersion_Patch) : ${{ needs.GitVersion_v6_Job.outputs.GitVersion_Patch }}" | |
echo "SemVer (needs.GitVersion_v6_Job.outputs.GitVersion_SemVer) : ${{ needs.GitVersion_v6_Job.outputs.GitVersion_SemVer }}" | |
echo "FullSemVer (needs.GitVersion_v6_Job.outputs.GitVersion_FullSemVer) : ${{ needs.GitVersion_v6_Job.outputs.GitVersion_FullSemVer }}" | |
name: Use direct output from previous job (bash - outputs with prefix) | |
shell: bash |