diff --git a/.github/workflows/conan-package.yml b/.github/workflows/conan-package.yml index bada3f5f6b..53033286fe 100644 --- a/.github/workflows/conan-package.yml +++ b/.github/workflows/conan-package.yml @@ -74,6 +74,7 @@ jobs: with: recipe_id_full: ${{ needs.conan-recipe-version.outputs.recipe_id_full }} recipe_id_latest: ${{ needs.conan-recipe-version.outputs.recipe_id_latest }} + recipe_id_pr: ${{ needs.conan-recipe-version.outputs.recipe_id_pr }} runs_on: 'ubuntu-20.04' python_version: '3.10.4' conan_config_branch: 'CURA-9177_Fix_CI_CD' @@ -82,7 +83,7 @@ jobs: conan-package-create-macos: # FIXME: For release branches: maybe rename the branch to release/** - if: ${{ (github.event_name == 'push' && (github.ref_name == 'main' || github.ref_name == '5.1')) || github.event == 'workflow_dispatch' || inputs.create_binaries_macos }} + if: ${{ (github.event_name == 'push' && (github.ref_name == 'main' || github.ref_name == '5.1')) || (github.event_name == 'workflow_dispatch' && inputs.create_binaries_macos) }} needs: [ conan-recipe-version, conan-package-export ] uses: ultimaker/cura/.github/workflows/conan-package-create.yml@CURA-9365_fix_building_cura_main @@ -96,7 +97,7 @@ jobs: conan-package-create-windows: # FIXME: For release branches: maybe rename the branch to release/** - if: ${{ (github.event_name == 'push' && (github.ref_name == 'main' || github.ref_name == '5.1')) || github.event == 'workflow_dispatch' || inputs.create_binaries_windows }} + if: ${{ (github.event_name == 'push' && (github.ref_name == 'main' || github.ref_name == '5.1')) || (github.event_name == 'workflow_dispatch' && inputs.create_binaries_windows) }} needs: [ conan-recipe-version, conan-package-export ] uses: ultimaker/cura/.github/workflows/conan-package-create.yml@CURA-9365_fix_building_cura_main @@ -110,7 +111,7 @@ jobs: conan-package-create-linux: # FIXME: For release branches: maybe rename the branch to release/** - if: ${{ (github.event_name == 'push' && (github.ref_name == 'main' || github.ref_name == '5.1')) || github.event == 'workflow_dispatch' || inputs.create_binaries_linux }} + if: ${{ (github.event_name == 'push' && (github.ref_name == 'main' || github.ref_name == '5.1')) || (github.event_name == 'workflow_dispatch' && inputs.create_binaries_linux) }} needs: [ conan-recipe-version, conan-package-export ] uses: ultimaker/cura/.github/workflows/conan-package-create.yml@CURA-9365_fix_building_cura_main diff --git a/.github/workflows/conan-recipe-export.yml b/.github/workflows/conan-recipe-export.yml index 32c92cb02e..a53059f52a 100644 --- a/.github/workflows/conan-recipe-export.yml +++ b/.github/workflows/conan-recipe-export.yml @@ -11,6 +11,10 @@ on: required: false type: string + recipe_id_pr: + required: false + type: string + runs_on: required: true type: string @@ -79,14 +83,19 @@ jobs: run: conan export-pkg . ${{ inputs.recipe_id_full }} - name: Export the Package - if: ${{ inputs.conan_export_binaries != 'true' }} + if: ${{ inputs.conan_export_binaries != 'true' && github.event_name != 'pull_request' }} run: conan export . ${{ inputs.recipe_id_full }} - name: Create the latest alias - if: ${{ inputs.recipe_id_latest == '' }} + if: ${{ inputs.recipe_id_latest != '' && github.event_name != 'pull_request' }} + run: conan alias ${{ inputs.recipe_id_latest }} ${{ inputs.recipe_id_full }} + + - name: Create the pull request alias + if: ${{ inputs.recipe_id_pr != '' && github.event_name == 'pull_request' }} run: conan alias ${{ inputs.recipe_id_latest }} ${{ inputs.recipe_id_full }} - name: Upload the Package(s) run: | + # Only use --all (upload binaries) for the cura repository conan upload "*" -r cura --all -c conan upload "*" -r cura-ce -c diff --git a/.github/workflows/conan-recipe-version.yml b/.github/workflows/conan-recipe-version.yml index 1c344aa3d0..6b04354de3 100644 --- a/.github/workflows/conan-recipe-version.yml +++ b/.github/workflows/conan-recipe-version.yml @@ -28,6 +28,7 @@ jobs: 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 }} @@ -68,11 +69,6 @@ jobs: # 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' - elif [ "${{ github.event_name == 'pull_request' }}" = "true" ]; then - # pull request events are considered unstable and are for testing purposes - # name/major.minor.patch-beta+build@ultimaker/pr_ - echo ${{ github.repository_owner }} | awk '{print "::set-output name=user::"tolower($0)}' - echo "::set-output name=channel::pr_$PR_NUMBER" else # commits on other branches are considered unstable and for development purposes only # Use the Cura branch naming scheme CURA-1234_foo_bar @@ -83,6 +79,17 @@ jobs: 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_ + 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 }}