-
Notifications
You must be signed in to change notification settings - Fork 0
134 lines (113 loc) · 4.41 KB
/
publish-release.yml
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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
name: Release
on:
workflow_call:
inputs:
public_artifactory:
type: boolean
default: false
os:
required: true
type: string
default: ubuntu-22.04
compiler:
type: string
default: clang-17
cmake-version:
type: string
default: 3.24.0
conan-version:
type: string
default: 2.3.0
conan-options:
type: string
use-tag: # if true an existing tag/release is update; otherwise the job fails. If true the job will also fail if the tag doesn't match the version reported via conan.
type: boolean
default: false
secrets:
CONAN_USER:
required: true
CONAN_PW:
required: true
jobs:
publish-release:
name: Creates a release for the current version defined in CMake and uploads a Conan package to conan.dice-research.org. Fails if release for the version exists already.
defaults:
run:
shell: bash
runs-on: ${{ inputs.os }}
steps:
- name: Fail fast if use-tag is used without a tag
if: ${{ inputs.use-tag && github.ref_type != 'tag' }}
run: exit 1
# setup env
- name: Install tools and requirements
run: |
sudo apt-get update
sudo apt-get install -y jq python3 python3-pip
- name: Add repos for for gcc-13 and clang-16,17
uses: dice-group/cpp-conan-release-reusable-workflow/.github/actions/setup_apt
- name: Ensure stdlib version
run: |
sudo apt-get install -y libstdc++-13-dev
- name: Get minimum cmake version
uses: lukka/get-cmake@latest
with:
cmakeVersion: ${{ inputs.cmake-version }}
- name: Install compiler
id: install_cc
uses: rlalik/[email protected]
with:
compiler: ${{ inputs.compiler }}
- name: Install mold
uses: rui314/setup-mold@v1
- name: Install conan
uses: dice-group/cpp-conan-release-reusable-workflow/.github/actions/configure_conan
with:
conan-version: ${{ inputs.conan-version }}
- name: add conan user
run: |
conan remote add dice-group https://conan.dice-research.org/artifactory/api/conan/tentris
conan remote login -p "${{ secrets.CONAN_PW }}" dice-group "${{ secrets.CONAN_USER }}"
conan remote add tentris-private https://conan.dice-research.org/artifactory/api/conan/tentris-private
conan remote login -p "${{ secrets.CONAN_PW }}" tentris-private "${{ secrets.CONAN_USER }}"
- name: Cache conan data
id: cache-conan
uses: actions/cache@v3
with:
path: ~/.conan2/p
key: ${{ inputs.os }}-${{ inputs.compiler }}-conan-reusable-workflow-release
- name: Checkout
uses: actions/checkout@v3
- name: Collect package information
shell: bash
run: |
pkg_name=$(conan inspect --format json . | jq -r '.name')
pkg_ver=$(conan inspect --format json . | jq -r '.version')
echo "conan_package_version=${pkg_ver}" >> $GITHUB_ENV
echo "conan_package_identifier=${pkg_name}/${pkg_ver}" >> $GITHUB_ENV
- name: Fail if use-tag and tag is not equal to package version from conan inspect
if: ${{ inputs.use-tag && github.ref_name != format('v{0}', env.conan_package_version) }}
run: exit 1
- name: Create github release
uses: ncipollo/release-action@v1
with:
tag: v${{ env.conan_package_version }}
allowUpdates: ${{ inputs.use-tag }}
- name: Create Package
env:
CC: ${{ steps.install_cc.outputs.cc }}
CXX: ${{ steps.install_cc.outputs.cxx }}
run: |
(conan remove -f "${{ env.conan_package_identifier }}:*" || true)
conan create --build missing ${{ inputs.conan-options }} .
- name: Select public artifactory for upload
if: ${{ fromJSON(inputs.public_artifactory) }}
run: |
echo "remote_artifactory_name=dice-group" >> $GITHUB_ENV
- name: Select private artifactory for upload
if: ${{ !fromJSON(inputs.public_artifactory) }}
run: |
echo "remote_artifactory_name=tentris-private" >> $GITHUB_ENV
- name: Upload to artifactory
run: |
conan upload "${{ env.conan_package_identifier }}" -r ${{ env.remote_artifactory_name }} --only-recipe