conan-recipe-version.yml 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. name: Get Conan Recipe Version
  2. on:
  3. workflow_call:
  4. inputs:
  5. project_name:
  6. required: true
  7. type: string
  8. outputs:
  9. recipe_id_full:
  10. description: "The full Conan recipe id: <name>/<version>@<user>/<channel>"
  11. value: ${{ jobs.get-semver.outputs.recipe_id_full }}
  12. recipe_id_latest:
  13. description: "The full Conan recipe aliased (latest) id: <name>/(latest)@<user>/<channel>"
  14. value: ${{ jobs.get-semver.outputs.recipe_id_latest }}
  15. recipe_semver_full:
  16. description: "The full semver <Major>.<Minor>.<Patch>-<PreReleaseTag>+<BuildMetaData>"
  17. value: ${{ jobs.get-semver.outputs.semver_full }}
  18. jobs:
  19. get-semver:
  20. runs-on: ubuntu-latest
  21. outputs:
  22. recipe_id_full: ${{ inputs.project_name }}/${{ steps.git-tool.outputs.Major }}.${{ steps.git-tool.outputs.Minor }}.${{ steps.git-tool.outputs.Patch }}-${{ steps.git-tool.outputs.PreReleaseLabel }}+${{ steps.git-tool.outputs.BuildMetaData }}@${{ steps.get-conan-broadcast-data.outputs.user }}/${{ steps.get-conan-broadcast-data.outputs.channel }}
  23. recipe_id_latest: ${{ steps.latest-alias.outputs.recipe_id_latest }}
  24. recipe_id_pr: ${{ steps.pr-alias.outputs.recipe_id_pr }}
  25. semver_full: ${{ steps.git-tool.outputs.Major }}.${{ steps.git-tool.outputs.Minor }}.${{ steps.git-tool.outputs.Patch }}-${{ steps.git-tool.outputs.PreReleaseLabel }}+${{ steps.git-tool.outputs.BuildMetaData }}
  26. user: ${{ steps.get-conan-broadcast-data.outputs.user }}
  27. channel: ${{ steps.get-conan-broadcast-data.outputs.channel }}
  28. steps:
  29. - name: Checkout repo
  30. uses: actions/checkout@v3
  31. with:
  32. ref: ${{ github.head_ref }}
  33. fetch-depth: 0
  34. - name: Install GitVersion
  35. uses: gittools/actions/gitversion/setup@v0.9.13
  36. with:
  37. versionSpec: '5.x'
  38. - name: GitTools
  39. id: git-tool
  40. uses: gittools/actions/gitversion/execute@v0.9.13
  41. - id: get-conan-broadcast-data
  42. name: Get Conan broadcast data
  43. run: |
  44. if [ "${{ github.ref_type == 'tag' && github.ref_name == '5.1' }}" = "true" ]; then
  45. # tagged commits on a release branch are actual released version and should have no user and channel
  46. # name/major.minor.patch@_/_
  47. # FIXME: For release branches: maybe rename the branch to release/**
  48. echo '::set-output name=user::_'
  49. echo '::set-output name=channel::_'
  50. elif [ "${{ github.ref_name == 'main' || github.ref_name == 'master' }}" = "true" ]; then
  51. # commits on main/master are alpha's (nightlies) and are considered testing
  52. # name/major.minor.patch-alpha+build@ultimaker/testing
  53. echo ${{ github.repository_owner }} | awk '{print "::set-output name=user::"tolower($0)}'
  54. echo '::set-output name=channel::testing'
  55. elif [ "${{ github.ref_name == '5.1' }}" = "true" ]; then
  56. # commits on release branches are beta's and are considered stable
  57. # name/major.minor.patch-beta+build@ultimaker/stable
  58. # FIXME: For release branches: maybe rename the branch to release/**
  59. echo ${{ github.repository_owner }} | awk '{print "::set-output name=user::"tolower($0)}'
  60. echo '::set-output name=channel::stable'
  61. else
  62. # commits on other branches are considered unstable and for development purposes only
  63. # Use the Cura branch naming scheme CURA-1234_foo_bar
  64. # we use the first 9 characters of the branch name
  65. # name/major.minor.patch-beta+build@ultimaker/cura_<jira_number>
  66. echo ${{ github.repository_owner }} | awk '{print "::set-output name=user::"tolower($0)}'
  67. branch=${{ github.ref_name }}
  68. sanitized_branch="${branch//-/_}"
  69. echo $sanitized_branch | awk '{print "::set-output name=channel::"substr(tolower($0),0,9)}'
  70. fi
  71. - name: Get pull request alias
  72. id: pr-alias
  73. run: |
  74. if [ "${{ github.event_name == 'pull_request' }}" = "true" ]; then
  75. # pull request events are considered unstable and are for testing purposes
  76. # name/latest@ultimaker/pr_<number>
  77. echo "::set-output name=recipe_id_pr::${{ inputs.project_name }}/latest@${{ steps.get-conan-broadcast-data.outputs.user }}/pr_$PR_NUMBER"
  78. else
  79. echo "::set-output name=recipe_id_pr::''"
  80. fi
  81. env:
  82. PR_NUMBER: ${{ github.event.issue.number }}
  83. - name: Get latest alias
  84. id: latest-alias
  85. run: |
  86. echo "::set-output name=recipe_id_latest::${{ inputs.project_name }}/latest@${{ steps.get-conan-broadcast-data.outputs.user }}/${{ steps.get-conan-broadcast-data.outputs.channel }}"