-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpublish-cheese3d-annotator.yaml
More file actions
57 lines (57 loc) · 2.15 KB
/
publish-cheese3d-annotator.yaml
File metadata and controls
57 lines (57 loc) · 2.15 KB
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
name: Publish to PyPi (cheese3d-annotator)
on:
push:
tags:
# Publish on any tag starting with a `v`, e.g., v0.1.0
- cheese3d-annotator/v*
jobs:
pypi-publish:
runs-on: ubuntu-latest
environment:
name: pypi
permissions:
id-token: write
contents: write
steps:
- uses: actions/checkout@v4
- name: Validate version matches tag
run: |
TAG_VERSION="${GITHUB_REF#refs/tags/cheese3d-annotator/v}"
TOML_VERSION=$(grep '^version' packages/cheese3d-annotator/pyproject.toml | head -1 | sed 's/version = "\(.*\)"/\1/')
if [ "$TAG_VERSION" != "$TOML_VERSION" ]; then
echo "Tag version ($TAG_VERSION) does not match pyproject.toml ($TOML_VERSION)"
exit 1
fi
- name: Install dependencies
uses: prefix-dev/setup-pixi@v0.9.5
with:
pixi-version: v0.66.0
cache: false
# cache-write: ${{ github.event_name == 'push' && github.ref_name == 'main' }}
environments: default
- name: Publish to PyPi
run: pixi run publish-ci cheese3d-annotator
- name: Refresh env lockfile and push
run: |
TAG_VERSION="${GITHUB_REF#refs/tags/cheese3d-annotator/v}"
echo "updating public-env to ${TAG_VERSION}"
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git fetch origin main
git checkout main
for i in $(seq 1 10); do
(cd public-env && pixi update --quiet cheese3d-annotator) || true
if grep -q "cheese3d_annotator-${TAG_VERSION}-" public-env/pixi.lock; then
echo "env lockfile now pins cheese3d-annotator ${TAG_VERSION}"
break
fi
echo "cheese3d-annotator ${TAG_VERSION} not visible on PyPi yet, retrying in 30s..."
sleep 30
done
if git diff --quiet public-env/pixi.lock; then
echo "public-env/pixi.lock unchanged, nothing to commit"
exit 0
fi
git add public-env/pixi.lock
git commit -m "public-env: refresh lockfile for cheese3d-annotator v${TAG_VERSION}"
git push origin main