1- name : Deploy to Pypi
1+ name : Deploy 📦 to Test- Pypi and Pypi 🐍
22
33on :
44 push :
@@ -23,47 +23,87 @@ jobs:
2323 python -m pip install -r requirements.txt
2424 python -m pip install -r doc/requirements_doc.txt
2525 pip install setuptools wheel
26+ - name : Install package
27+ run : |
28+ python -m pip install -e .
2629 - name : Make doc
2730 run : |
2831 cd doc
2932 python minify.py
3033 make html
3134 cd ..
32- - name : Install package
33- run : |
34- python -m pip install -e .
3535 - name : Build a binary wheel and a source tarball
3636 run : |
3737 python setup.py sdist bdist_wheel
38- - name : Publish package to TestPyPI
39- uses : pypa/gh-action-pypi-publish@master
40- with :
41- user : __token__
42- password : ${{ secrets.TEST_PYPI_PASSWORD }}
43- repository_url : https://test.pypi.org/legacy/
44- - name : Publish package to PyPI
45- uses : pypa/gh-action-pypi-publish@master
38+ - name : Store the distribution packages
39+ uses : actions/upload-artifact@v4
4640 with :
47- user : __token__
48- password : ${{ secrets.PYPI_PASSWORD }}
49- - name : Push doc to stable
50- if : success()
51- run : |
52- # Add deploy key and clone through ssh
53- eval "$(ssh-agent -s)"
54- mkdir ~/.ssh
55- echo "${{ secrets.DEPLOY_DOC_KEY }}" > ~/.ssh/id_rsa
56- chmod 600 ~/.ssh/id_rsa
57- ssh-keyscan -t rsa github.com
58- echo 'Documentation was successfully built, updating the website.'
59- # See https://github.community/t/github-actions-bot-email-address/17204/5
60- git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
61- git config --global user.name "github-actions"
62- git clone "git@github.com:tensorly/tensorly.github.io.git" doc_folder
63- echo "-- Updating the content"
64- cd doc_folder
65- cp -r dev/* stable/
66- echo "Pushing to git"
67- git add stable
68- git commit -m "Github action: new release."
69- git push --force origin main
41+ name : python-package-distributions
42+ path : dist/
43+
44+ publish-to-testpypi :
45+ name : Publish Python 🐍 distribution 📦 to TestPyPI
46+ needs :
47+ - build
48+ runs-on : ubuntu-latest
49+
50+ environment :
51+ name : testpypi
52+ url : https://test.pypi.org/p/tensorly
53+
54+ permissions :
55+ id-token : write
56+
57+ steps :
58+ - name : Download all the dists
59+ uses : actions/download-artifact@v4
60+ with :
61+ name : python-package-distributions
62+ path : dist/
63+ - name : Publish distribution 📦 to TestPyPI
64+ uses : pypa/gh-action-pypi-publish@release/v1
65+ with :
66+ repository-url : https://test.pypi.org/legacy/
67+
68+ publish-to-pypi :
69+ name : >-
70+ Publish Python 🐍 distribution 📦 to PyPI
71+ if : startsWith(github.ref, 'refs/tags/') # only publish to PyPI on tag pushes
72+ needs :
73+ - build
74+ runs-on : ubuntu-latest
75+ environment :
76+ name : pypi
77+ url : https://pypi.org/p/tensorly # Replace <package-name> with your PyPI project name
78+ permissions :
79+ id-token : write # IMPORTANT: mandatory for trusted publishing
80+
81+ steps :
82+ - name : Download all the dists
83+ uses : actions/download-artifact@v4
84+ with :
85+ name : python-package-distributions
86+ path : dist/
87+ - name : Publish distribution 📦 to PyPI
88+ uses : pypa/gh-action-pypi-publish@release/v1
89+ - name : Push doc to stable if upload was successful
90+ if : success()
91+ run : |
92+ # Add deploy key and clone through ssh
93+ eval "$(ssh-agent -s)"
94+ mkdir ~/.ssh
95+ echo "${{ secrets.DEPLOY_DOC_KEY }}" > ~/.ssh/id_rsa
96+ chmod 600 ~/.ssh/id_rsa
97+ ssh-keyscan -t rsa github.com
98+ echo 'Documentation was successfully built, updating the website.'
99+ # See https://github.community/t/github-actions-bot-email-address/17204/5
100+ git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
101+ git config --global user.name "github-actions"
102+ git clone "git@github.com:tensorly/tensorly.github.io.git" doc_folder
103+ echo "-- Updating the content"
104+ cd doc_folder
105+ cp -r dev/* stable/
106+ echo "Pushing to git"
107+ git add stable
108+ git commit -m "Github action: new release."
109+ git push --force origin main
0 commit comments