blob: dd30e8807a333e4308f41347a9be806d50b39528 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
|
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.get-conan-broadcast-data.outputs.version }}@${{ 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.get-conan-broadcast-data.outputs.version }}
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 == '${{ steps.git-tool.outputs.Major }}.${{ steps.git-tool.outputs.Minor }}.${{ steps.git-tool.outputs.Patch }}' }}" = "true" ]; then
# tagged commits on a release branch matching the major.minor.patch are actual released version and should have no user and channel
# name/major.minor.patch@_/_
echo '::set-output name=user::_'
echo '::set-output name=channel::_'
echo '::set-output name=version::${{ steps.git-tool.outputs.Major }}.${{ steps.git-tool.outputs.Minor }}.${{ steps.git-tool.outputs.Patch }}'
elif [ "${{ github.ref_type == 'tag' && github.ref_name == '${{ steps.git-tool.outputs.Major }}.${{ steps.git-tool.outputs.Minor }}.${{ steps.git-tool.outputs.Patch }}-BETA' }}" = "true" ]; then
# tagged commits with major.minor.patch-BETA on a release branch are actual released version and should have no user and channel
# name/major.minor.patch-beta@_/_
echo '::set-output name=user::_'
echo '::set-output name=channel::_'
echo '::set-output name=version::${{ steps.git-tool.outputs.Major }}.${{ steps.git-tool.outputs.Minor }}.${{ steps.git-tool.outputs.Patch }}-${{ steps.git-tool.outputs.PreReleaseLabel }}'
elif [ "${{ github.ref_name == 'main' || github.ref_name == 'master' }}" = "true" ]; then
# commits on main/master are alpha's (nightlies) and are considered testing
# name/major.minor.patch-alpha+build@ultimaker/testing
echo ${{ github.repository_owner }} | awk '{print "::set-output name=user::"tolower($0)}'
echo '::set-output name=channel::testing'
echo '::set-output name=version::${{ 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 }}'
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'
echo '::set-output name=version::${{ 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 }}'
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)}'
echo '::set-output version=${{ 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 }}'
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 }}"
|