Skip to content

Commit 7fcda88

Browse files
committed
prepare for tagging
1 parent 505f06d commit 7fcda88

File tree

3 files changed

+450
-40
lines changed

3 files changed

+450
-40
lines changed
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
name: Publish to Conan Center
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
8+
jobs:
9+
publish:
10+
runs-on: ubuntu-latest
11+
permissions:
12+
contents: read
13+
pull-requests: write
14+
15+
steps:
16+
- name: Checkout repository
17+
uses: actions/checkout@v4
18+
with:
19+
fetch-depth: 0
20+
21+
- name: Extract version from tag
22+
id: version
23+
run: |
24+
VERSION=${GITHUB_REF#refs/tags/v}
25+
echo "version=${VERSION}" >> $GITHUB_OUTPUT
26+
echo "Tag: ${GITHUB_REF}, Version: ${VERSION}"
27+
28+
- name: Setup Git
29+
run: |
30+
git config --global user.name "github-actions[bot]"
31+
git config --global user.email "github-actions[bot]@users.noreply.github.com"
32+
33+
- name: Checkout conan-center-index
34+
uses: actions/checkout@v4
35+
with:
36+
repository: d-led/conan-center-index
37+
path: conan-center-index
38+
token: ${{ secrets.GITHUB_TOKEN }}
39+
40+
- name: Setup conan-center-index upstream
41+
working-directory: conan-center-index
42+
run: |
43+
git remote add upstream https://github.com/conan-io/conan-center-index.git || true
44+
git fetch upstream master
45+
git checkout master || git checkout -b master
46+
git merge upstream/master || true
47+
48+
- name: Install GitHub CLI
49+
run: |
50+
type -p curl >/dev/null || (apt update && apt install curl -y)
51+
curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg \
52+
&& chmod go+r /usr/share/keyrings/githubcli-archive-keyring.gpg \
53+
&& echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | tee /etc/apt/sources.list.d/github-cli.list > /dev/null \
54+
&& apt update \
55+
&& apt install gh -y
56+
57+
- name: Authenticate GitHub CLI
58+
run: |
59+
echo "${{ secrets.GITHUB_TOKEN }}" | gh auth login --with-token
60+
61+
- name: Publish to Conan Center
62+
env:
63+
GITHUB_REPO: d-led/influxdb-cpp-rest
64+
CONAN_INDEX_FORK: d-led/conan-center-index
65+
CONAN_INDEX_UPSTREAM: conan-io/conan-center-index
66+
CONAN_INDEX_DIR: ${{ github.workspace }}/conan-center-index
67+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
68+
run: |
69+
./scripts/publish-conan-version.sh "${{ steps.version.outputs.version }}"
70+

docs/development.md

Lines changed: 82 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -158,66 +158,97 @@ These bundled dependencies may be migrated to Conan in the future.
158158

159159
## Publishing to Conan Center
160160

161-
### Prerequisites
161+
The package is published to [Conan Center](https://conan.io/center) via pull requests to the [conan-center-index](https://github.com/conan-io/conan-center-index) repository. The recipe is maintained at `recipes/influxdb-cpp-rest/` in that repository.
162162

163-
1. Conan 2.0+
164-
2. Conan account at https://conan.io/
165-
3. GitHub repository (public)
163+
### Initial Setup (One-time)
166164

167-
### Publishing Steps
165+
1. Fork https://github.com/conan-io/conan-center-index
166+
2. Clone your fork locally
167+
3. Set upstream remote: `git remote add upstream https://github.com/conan-io/conan-center-index.git`
168168

169-
1. **Update version in conanfile.py**
169+
### Publishing a New Version
170170

171-
Update the `version` field in `conanfile.py`:
172-
```python
173-
version = "1.0.0" # or your new version
174-
```
175-
176-
2. **Create Conan recipe (if not exists)**
171+
Use the automated script (recommended):
177172

178-
The `conanfile.py` should export all necessary files and define requirements.
173+
```bash
174+
./scripts/publish-conan-version.sh 1.0.0
175+
```
179176

180-
3. **Test the recipe locally**
177+
Or manually:
181178

179+
1. **Create a GitHub release/tag** for the version (if not already exists)
180+
2. **Navigate to conan-center-index repository**:
182181
```bash
183-
conan create . --version 1.0.0
182+
cd ../conan-center-index # or wherever you cloned it
183+
git checkout master
184+
git pull upstream master
184185
```
185-
186-
Test with different configurations:
186+
3. **Create version branch**:
187+
```bash
188+
git checkout -b recipes/influxdb-cpp-rest/X.Y.Z
189+
```
190+
4. **Create recipe directory and files**:
187191
```bash
188-
conan create . --version 1.0.0 -s compiler=gcc -s compiler.version=11
189-
conan create . --version 1.0.0 -s compiler=clang -s compiler.version=14
192+
mkdir -p recipes/influxdb-cpp-rest/X.Y.Z
193+
# Copy conanfile.py template and adapt for conan-center-index format
194+
# Create conandata.yml with source URL and SHA256
195+
```
196+
5. **Commit and push**:
197+
```bash
198+
git add recipes/influxdb-cpp-rest/X.Y.Z/
199+
git commit -m "Add influxdb-cpp-rest/X.Y.Z"
200+
git push origin recipes/influxdb-cpp-rest/X.Y.Z
201+
```
202+
6. **Create pull request**:
203+
```bash
204+
gh pr create --repo conan-io/conan-center-index --title "Add influxdb-cpp-rest/X.Y.Z"
190205
```
191206

192-
4. **Export recipe**
207+
See [Publishing New Versions](#publishing-new-versions) section below for details.
193208

209+
## Publishing New Versions
210+
211+
When releasing a new version of influxdb-cpp-rest:
212+
213+
1. **Create and push a Git tag** (e.g., `v1.0.0`):
194214
```bash
195-
conan export . --version 1.0.0
215+
./scripts/tag-version.sh patch # or major/minor
216+
git push --tags
196217
```
197218

198-
5. **Upload to Conan Center**
219+
2. **Automatic publishing**: Pushing a tag starting with `v` (e.g., `v1.0.0`) automatically triggers the GitHub Actions workflow that:
220+
- Calculates the SHA256 hash of the source tarball
221+
- Creates the recipe files in the correct format
222+
- Commits and pushes to your conan-center-index fork
223+
- Creates a pull request to conan-center-index
199224

200-
First, create a pull request to Conan Center Index:
201-
202-
- Fork https://github.com/conan-io/conan-center-index
203-
- Create branch: `recipes/influxdb-cpp-rest/x.y.z` (where x.y.z is version)
204-
- Copy your `conanfile.py` to `recipes/influxdb-cpp-rest/x.y.z/conanfile.py`
205-
- Add recipe files to the index repository
206-
- Open a pull request
225+
3. **Monitor the PR**: The Conan Center CI will automatically test the recipe. Address any review comments or CI failures.
207226

208-
The Conan Center team will review and merge your recipe.
227+
### Manual Publishing (Alternative)
209228

210-
6. **Alternative: Upload to your own remote**
229+
If you need to publish manually or the automated workflow fails:
211230

212-
If you want to publish to your own Conan remote:
213-
214-
```bash
215-
# Add your remote
216-
conan remote add myremote https://your-conan-server.com
217-
218-
# Upload
219-
conan upload influxdb-cpp-rest/1.0.0 -r myremote --all
220-
```
231+
```bash
232+
./scripts/publish-conan-version.sh 1.0.0
233+
```
234+
235+
This script will:
236+
- Clone/update your conan-center-index fork if needed
237+
- Calculate the SHA256 hash of the source tarball
238+
- Create the recipe files in the correct format
239+
- Commit and push the changes
240+
- Create a pull request to conan-center-index
241+
242+
### Recipe Format for Conan Center
243+
244+
The recipe in conan-center-index differs from the local `conanfile.py`:
245+
246+
- **No `version` field** - version comes from directory path
247+
- **`source()` method** - downloads from GitHub release/tag
248+
- **`conandata.yml`** - contains source URL and SHA256 checksum
249+
- **No `exports_sources`** - source is downloaded, not exported
250+
251+
The automation script handles these differences automatically.
221252

222253
### Conan Recipe Checklist
223254

@@ -229,13 +260,24 @@ These bundled dependencies may be migrated to Conan in the future.
229260
- [ ] Compatible with major compilers (GCC, Clang, MSVC)
230261
- [ ] Works on Linux, macOS, Windows
231262

263+
### Testing Locally
264+
265+
Before publishing, test the recipe locally:
266+
267+
```bash
268+
# In your conan-center-index fork
269+
cd recipes/influxdb-cpp-rest/1.0.0
270+
conan create . influxdb-cpp-rest/1.0.0@
271+
```
272+
232273
### Conan Center Requirements
233274

234275
- Recipe must be in conan-center-index repository
235276
- Must pass automated CI checks
236277
- All dependencies must also be in Conan Center
237278
- License must be compatible with Conan Center
238279
- Source code must be publicly accessible
280+
- GitHub tag/release must exist for the version
239281

240282
### Versioning
241283

0 commit comments

Comments
 (0)