forked from Ultraplot/UltraPlot
-
Notifications
You must be signed in to change notification settings - Fork 1
95 lines (81 loc) · 2.87 KB
/
Copy pathpublish-conda.yml
File metadata and controls
95 lines (81 loc) · 2.87 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
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
name: Publish to Conda
on:
release:
types: [published]
jobs:
publish-conda:
needs: [build, publish-test]
runs-on: ubuntu-latest
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/v')
permissions:
# Required for trusted publishing to PyPI
id-token: write
contents: read
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.x"
- name: Install build
run: python -m pip install build
- name: Build package
run: python -m build
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
- name: Publish to Anaconda
uses: conda-incubator/setup-miniconda@v3
with:
auto-activate-base: false
environment-file: environment-dev.yml
- name: Install conda-build
shell: bash -l {0}
run: |
micromamba activate ultraplot-dev
micromamba install conda-build anaconda-client
- name: Clone staged-recipes
run: git clone https://github.com/cvanelteren/staged-recipes.git
- name: Check if recipe exists
run: |
if [ -d "staged-recipes/recipes/ultraplot" ]; then
echo "Recipe already exists. Checking version..."
RECIPE_VERSION=$(grep "version:"staged-recipes/recipes/ultraplot/meta.yaml | awk {print $2}')
PACKAGE_VERSION=$(python setup.py --version)
if [ "$RECIPE_VERSION" == "$PACKAGE_VERSION" ];then
echo "Recipe is up-to-date. Skipping."
exit 0
fi
fi
- name: Extract version from pyproject.toml
id: get-version
run: |
pip install tomli
python -c "
import tomli
with open('pyproject.toml', 'rb') as f:
data = tomli.load(f)
print(data['project']['version'])
" > version.txt
- name: Generate meta.yaml
run: |
mkdir -p staged-recipes/recipes/ultraplot
cat <<EOF > staged-recipes/recipes/ultraplot/meta.yaml
# Same meta.yaml generation script as above
EOF
- name: Push changes to fork
run: |
git add staged-recipes/recipes/ultraplot
git commit -m "Update ultraplot recipe to version $(cat version.txt)"
git push origin update-ultraplot-recipe
- name: Create Pull Request
uses: peter-evans/create-pull-request@v5
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: "Update ultraplot recipe to version $(cat version.txt)"
branch: update-ultraplot-recipe
title: "Update ultraplot recipe"
body: |
This PR updates the ultraplot recipe to version $(cat version.txt).