|
@@ -0,0 +1,99 @@
|
|
|
+name: Get Conan Recipe Version
|
|
|
+
|
|
|
+on:
|
|
|
+ workflow_call:
|
|
|
+ inputs:
|
|
|
+ project_name:
|
|
|
+ required: true
|
|
|
+ type: string
|
|
|
+
|
|
|
+ outputs:
|
|
|
+ recipe_id_full:
|
|
|
+ description: "The full Conan recipe id: <name>/<version>@<user>/<channel>"
|
|
|
+ value: ${{ jobs.get-semver.outputs.recipe_id_full }}
|
|
|
+
|
|
|
+ recipe_id_latest:
|
|
|
+ description: "The full Conan recipe aliased (latest) id: <name>/(latest)@<user>/<channel>"
|
|
|
+ value: ${{ jobs.get-semver.outputs.recipe_id_latest }}
|
|
|
+
|
|
|
+ recipe_semver_full:
|
|
|
+ description: "The full semver <Major>.<Minor>.<Patch>-<PreReleaseTag>+<BuildMetaData>"
|
|
|
+ value: ${{ jobs.get-semver.outputs.semver_full }}
|
|
|
+
|
|
|
+jobs:
|
|
|
+ get-semver:
|
|
|
+
|
|
|
+ runs-on: ubuntu-latest
|
|
|
+
|
|
|
+ outputs:
|
|
|
+ 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 }}
|
|
|
+ recipe_id_latest: ${{ steps.latest-alias.outputs.recipe_id_latest }}
|
|
|
+ recipe_id_pr: ${{ steps.pr-alias.outputs.recipe_id_pr }}
|
|
|
+ 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 }}
|
|
|
+ user: ${{ steps.get-conan-broadcast-data.outputs.user }}
|
|
|
+ channel: ${{ steps.get-conan-broadcast-data.outputs.channel }}
|
|
|
+
|
|
|
+ steps:
|
|
|
+ - name: Checkout repo
|
|
|
+ uses: actions/checkout@v3
|
|
|
+ with:
|
|
|
+ ref: ${{ github.head_ref }}
|
|
|
+ fetch-depth: 0
|
|
|
+
|
|
|
+ - name: Install GitVersion
|
|
|
+ uses: gittools/actions/gitversion/setup@v0.9.13
|
|
|
+ with:
|
|
|
+ versionSpec: '5.x'
|
|
|
+
|
|
|
+ - name: GitTools
|
|
|
+ id: git-tool
|
|
|
+ uses: gittools/actions/gitversion/execute@v0.9.13
|
|
|
+
|
|
|
+ - id: get-conan-broadcast-data
|
|
|
+ name: Get Conan broadcast data
|
|
|
+ run: |
|
|
|
+ if [ "${{ github.ref_type == 'tag' && github.ref_name == '5.1' }}" = "true" ]; then
|
|
|
+ # tagged commits on a release branch are actual released version and should have no user and channel
|
|
|
+ # name/major.minor.patch@_/_
|
|
|
+ # FIXME: For release branches: maybe rename the branch to release/**
|
|
|
+ echo '::set-output name=user::_'
|
|
|
+ echo '::set-output name=channel::_'
|
|
|
+ elif [ "${{ github.ref_name == 'main' }}" = "true" ]; then
|
|
|
+ # commits on main are alpha's (nightlies) and are considered stable
|
|
|
+ # name/major.minor.patch-alpha+build@ultimaker/stable
|
|
|
+ echo ${{ github.repository_owner }} | awk '{print "::set-output name=user::"tolower($0)}'
|
|
|
+ echo '::set-output name=channel::stable'
|
|
|
+ elif [ "${{ github.ref_name == '5.1' }}" = "true" ]; then
|
|
|
+ # commits on release branches are beta's and are considered stable
|
|
|
+ # name/major.minor.patch-beta+build@ultimaker/stable
|
|
|
+ # FIXME: For release branches: maybe rename the branch to release/**
|
|
|
+ echo ${{ github.repository_owner }} | awk '{print "::set-output name=user::"tolower($0)}'
|
|
|
+ echo '::set-output name=channel::stable'
|
|
|
+ else
|
|
|
+ # commits on other branches are considered unstable and for development purposes only
|
|
|
+ # Use the Cura branch naming scheme CURA-1234_foo_bar
|
|
|
+ # we use the first 9 characters of the branch name
|
|
|
+ # name/major.minor.patch-beta+build@ultimaker/cura_<jira_number>
|
|
|
+ echo ${{ github.repository_owner }} | awk '{print "::set-output name=user::"tolower($0)}'
|
|
|
+ branch=${{ github.ref_name }}
|
|
|
+ sanitized_branch="${branch//-/_}"
|
|
|
+ echo $sanitized_branch | awk '{print "::set-output name=channel::"substr(tolower($0),0,9)}'
|
|
|
+ fi
|
|
|
+
|
|
|
+ - name: Get pull request alias
|
|
|
+ id: pr-alias
|
|
|
+ run: |
|
|
|
+ if [ "${{ github.event_name == 'pull_request' }}" = "true" ]; then
|
|
|
+ # pull request events are considered unstable and are for testing purposes
|
|
|
+ # name/latest@ultimaker/pr_<number>
|
|
|
+ echo "::set-output name=recipe_id_pr::${{ inputs.project_name }}/latest@${{ steps.get-conan-broadcast-data.outputs.user }}/pr_$PR_NUMBER"
|
|
|
+ else
|
|
|
+ echo "::set-output name=recipe_id_pr::''"
|
|
|
+ fi
|
|
|
+ env:
|
|
|
+ PR_NUMBER: ${{ github.event.issue.number }}
|
|
|
+
|
|
|
+ - name: Get latest alias
|
|
|
+ id: latest-alias
|
|
|
+ run: |
|
|
|
+ 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 }}"
|