1+ # This workflows will upload a Python Package using twine when a release is created
2+ # For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries
3+
4+ name : Build and Release Wheels
5+
6+ on :
7+ release :
8+ types : [created]
9+
10+ permissions :
11+ contents : write
12+
13+ jobs :
14+
15+ # Build the wheels using reusable_building.yml
16+ build_wheels :
17+ name : Call reusable building workflow
18+ uses : ./.github/workflows/building.yml
19+
20+ create_release_and_upload_packages :
21+ name : Uplodad to Github Release
22+ needs : [build_wheels]
23+ runs-on : ubuntu-latest
24+ strategy :
25+ fail-fast : false
26+ matrix :
27+ python-version : ['3.10']
28+ steps :
29+
30+ - name : Checkout code
31+ uses : actions/checkout@v3
32+
33+ - name : Download packages
34+ id : download_artifacts
35+ uses : actions/download-artifact@v3
36+ with :
37+ name : compiled_wheels_python${{ matrix.python-version }}
38+ path : dist
39+
40+ - name : Upload packages to GitHub Release
41+ id : upload_assets
42+ run : |
43+ for file in $(ls ./dist/*.*); do
44+ echo "Uploading $file..."
45+ filename=$(basename "$file")
46+ encoded_filename=$(echo "$filename" | sed 's/+/%2B/g')
47+ curl -X POST \
48+ -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
49+ -H "Content-Type: application/zip" \
50+ --data-binary @"$file" \
51+ "${{ github.event.release.upload_url }}=$encoded_filename"
52+ done
53+
54+ generate_simple_index_pages :
55+ name : Generate Simple Index Pages
56+ needs : [create_release_and_upload_packages]
57+ runs-on : ubuntu-latest
58+ steps :
59+
60+ - name : Checkout code
61+ uses : actions/checkout@v3
62+
63+ - name : Generate Simple Index Pages
64+ run : python .github/workflows/generate_simple_index_pages.py --outdir ./whl
65+ env :
66+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
67+
68+ - name : Deploy to GitHub Pages
69+ uses : peaceiris/actions-gh-pages@v3
70+ with :
71+ github_token : ${{ secrets.GITHUB_TOKEN }}
72+ publish_dir : ./whl # Directory where the simple index pages are located
73+ destination_dir : whl # The 'wh' folder in the GitHub Pages root
74+ keep_files : false # This will only erase the destination subdirectory.
75+ cname : docs.gsplat.studio
76+
77+ upload_pypi :
78+ name : Upload to PyPi
79+ needs : [build_wheels]
80+ runs-on : ubuntu-latest
81+ environment : production
82+ steps :
83+
84+ - uses : actions/download-artifact@v3
85+ with :
86+ name : pypi_packages
87+ path : dist
88+
89+ - name : Set up Python
90+ uses : actions/setup-python@v4
91+ with :
92+ python-version : ' 3.7'
93+
94+ - name : Install dependencies
95+ run : |
96+ python -m pip install build twine
97+ shell : bash
98+
99+ # - name: Publish package to Test PyPI
100+ # uses: pypa/gh-action-pypi-publish@release/v1
101+ # with:
102+ # password: ${{ secrets.TEST_PYPI_API_TOKEN }}
103+ # repository-url: https://test.pypi.org/legacy/
104+
105+ - name : Publish package to PyPI
106+ env :
107+ PYPI_TOKEN : ${{ secrets.PYPI_TOKEN }}
108+ run : |
109+ twine upload --username __token__ --password $PYPI_TOKEN dist/*
110+ shell : bash
0 commit comments