-
Notifications
You must be signed in to change notification settings - Fork 0
109 lines (93 loc) · 3.62 KB
/
publish.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
name: Publish
on:
release:
types: [published]
pull_request:
jobs:
deploy:
name: Deploy to package index
runs-on: ubuntu-20.04
env:
PYTHON_VERSION: 3.9
REPOSITORY_USERNAME: ${{ secrets.PYPI_USERNAME }}
REPOSITORY_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
REPOSITORY_URL: ${{ secrets.PYPI_PUBLISH_URL }}
ANACONDA_TOKEN: ${{ secrets.ANACONDA_TOKEN }}
CONDA_ENV_NAME: conda-env
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Setup Conda
uses: conda-incubator/setup-miniconda@v3
with:
miniconda-version: "latest"
activate-environment: ${{ env.CONDA_ENV_NAME }}
python-version: ${{ env.PYTHON_VERSION }}
- name: Install Poetry
uses: snok/install-poetry@v1
- name: Configure Poetry
run: |
poetry config repositories.publish $REPOSITORY_URL
poetry config http-basic.publish $REPOSITORY_USERNAME $REPOSITORY_PASSWORD
- name: Build
run: |
poetry build
- name: Publish to Anaconda
shell: bash -el {0}
run: |
count=0
max_retries=5
tag=${{ github.event.release.tag_name }}
version=0.9.0
while [ $count -lt $max_retries ]; do
if pip install fds.sdk.utils==${version} --dry-run &>/dev/null; then
echo "Version ${version} of fds.sdk.utils is available on PyPI."
conda install grayskull conda-build anaconda-client
conda info
conda list
grayskull --version
anaconda --version
# Create meta.yaml recipe for the package pulled from PyPi
grayskull pypi fds.sdk.utils==${version}
# Modify the meta.yaml recipe-maintainers property to include all maintainers of this repo
sed -i "/recipe-maintainers:/,/extra:/ s/- .*/- gdulafactset/" fds.sdk.utils/meta.yaml
echo " - mima0815" >> fds.sdk.utils/meta.yaml
echo " - eschmidtfds" >> fds.sdk.utils/meta.yaml
echo " - Filip1x9" >> fds.sdk.utils/meta.yaml
echo " - dgawande12" >> fds.sdk.utils/meta.yaml
# Build conda package
conda config --set anaconda_upload no
package_file=$(conda build fds.sdk.utils --output)
cd /home/runner/miniconda3/envs/conda-env/conda-bld/noarch
ls -la
echo "#####"
cd /home/runner/miniconda3/envs/conda-env/conda-bld
ls -la
echo "#####"
cd /home/runner/miniconda3/envs/conda-env
ls -la
echo "#####"
cd /home/runner/miniconda3/envs
ls -la
echo "#####"
cd /home/runner/miniconda
ls -la
echo "#####"
cd /home/runner/work/enterprise-sdk-utils-python/enterprise-sdk-utils-python/fds.sdk.utils
ls -la
anaconda -t $ANACONDA_TOKEN upload -u factset -l main ${package_file}
break
else
echo "Version ${version} not found, rechecking in $((2 ** count)) seconds..."
sleep $((2 ** count))
count=$((count + 1))
fi
done
if [ $count -eq $max_retries ]; then
echo "Maximum retries reached, package with that version was not found, publish failed."
exit 1
fi