Only create alias on PR's

Contributes to CURA-9365
This commit is contained in:
j.spijker@ultimaker.com 2022-06-23 07:36:58 +02:00 committed by Jelle Spijker
parent b0448006c1
commit 06f6ce1eff
3 changed files with 27 additions and 10 deletions

View File

@ -74,6 +74,7 @@ jobs:
with: with:
recipe_id_full: ${{ needs.conan-recipe-version.outputs.recipe_id_full }} recipe_id_full: ${{ needs.conan-recipe-version.outputs.recipe_id_full }}
recipe_id_latest: ${{ needs.conan-recipe-version.outputs.recipe_id_latest }} 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' runs_on: 'ubuntu-20.04'
python_version: '3.10.4' python_version: '3.10.4'
conan_config_branch: 'CURA-9177_Fix_CI_CD' conan_config_branch: 'CURA-9177_Fix_CI_CD'
@ -82,7 +83,7 @@ jobs:
conan-package-create-macos: conan-package-create-macos:
# FIXME: For release branches: maybe rename the branch to release/** # 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 ] needs: [ conan-recipe-version, conan-package-export ]
uses: ultimaker/cura/.github/workflows/conan-package-create.yml@CURA-9365_fix_building_cura_main uses: ultimaker/cura/.github/workflows/conan-package-create.yml@CURA-9365_fix_building_cura_main
@ -96,7 +97,7 @@ jobs:
conan-package-create-windows: conan-package-create-windows:
# FIXME: For release branches: maybe rename the branch to release/** # 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 ] needs: [ conan-recipe-version, conan-package-export ]
uses: ultimaker/cura/.github/workflows/conan-package-create.yml@CURA-9365_fix_building_cura_main uses: ultimaker/cura/.github/workflows/conan-package-create.yml@CURA-9365_fix_building_cura_main
@ -110,7 +111,7 @@ jobs:
conan-package-create-linux: conan-package-create-linux:
# FIXME: For release branches: maybe rename the branch to release/** # 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 ] needs: [ conan-recipe-version, conan-package-export ]
uses: ultimaker/cura/.github/workflows/conan-package-create.yml@CURA-9365_fix_building_cura_main uses: ultimaker/cura/.github/workflows/conan-package-create.yml@CURA-9365_fix_building_cura_main

View File

@ -11,6 +11,10 @@ on:
required: false required: false
type: string type: string
recipe_id_pr:
required: false
type: string
runs_on: runs_on:
required: true required: true
type: string type: string
@ -79,14 +83,19 @@ jobs:
run: conan export-pkg . ${{ inputs.recipe_id_full }} run: conan export-pkg . ${{ inputs.recipe_id_full }}
- name: Export the Package - 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 }} run: conan export . ${{ inputs.recipe_id_full }}
- name: Create the latest alias - 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 }} run: conan alias ${{ inputs.recipe_id_latest }} ${{ inputs.recipe_id_full }}
- name: Upload the Package(s) - name: Upload the Package(s)
run: | run: |
# Only use --all (upload binaries) for the cura repository
conan upload "*" -r cura --all -c conan upload "*" -r cura --all -c
conan upload "*" -r cura-ce -c conan upload "*" -r cura-ce -c

View File

@ -28,6 +28,7 @@ jobs:
outputs: 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_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_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 }} 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 }} user: ${{ steps.get-conan-broadcast-data.outputs.user }}
channel: ${{ steps.get-conan-broadcast-data.outputs.channel }} channel: ${{ steps.get-conan-broadcast-data.outputs.channel }}
@ -68,11 +69,6 @@ jobs:
# FIXME: For release branches: maybe rename the branch to release/** # FIXME: For release branches: maybe rename the branch to release/**
echo ${{ github.repository_owner }} | awk '{print "::set-output name=user::"tolower($0)}' echo ${{ github.repository_owner }} | awk '{print "::set-output name=user::"tolower($0)}'
echo '::set-output name=channel::stable' 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_<number>
echo ${{ github.repository_owner }} | awk '{print "::set-output name=user::"tolower($0)}'
echo "::set-output name=channel::pr_$PR_NUMBER"
else else
# commits on other branches are considered unstable and for development purposes only # commits on other branches are considered unstable and for development purposes only
# Use the Cura branch naming scheme CURA-1234_foo_bar # Use the Cura branch naming scheme CURA-1234_foo_bar
@ -83,6 +79,17 @@ jobs:
sanitized_branch="${branch//-/_}" sanitized_branch="${branch//-/_}"
echo $sanitized_branch | awk '{print "::set-output name=channel::"substr(tolower($0),0,9)}' echo $sanitized_branch | awk '{print "::set-output name=channel::"substr(tolower($0),0,9)}'
fi 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: env:
PR_NUMBER: ${{ github.event.issue.number }} PR_NUMBER: ${{ github.event.issue.number }}