Skip to content

Commit a44707d

Browse files
authored
Update deploy_to_pypi.yml
1 parent 7c1aef3 commit a44707d

1 file changed

Lines changed: 23 additions & 3 deletions

File tree

.github/workflows/deploy_to_pypi.yml

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,24 @@ jobs:
1212
uses: actions/setup-python@v1
1313
with:
1414
python-version: 3.9
15+
16+
- name: Get version number
17+
id: v
18+
run: >-
19+
echo "::set-output name=VERSION::${GITHUB_REF/refs\/tags\/v}"
20+
1521
- name: Set version number
16-
if: startsWith(github.ref, 'refs/tags')
22+
if: startsWith(github.ref, 'refs/tags/v')
1723
run: >-
18-
sed -i "s/= dev/= ${GITHUB_REF/refs\/tags\/v}/" setup.cfg
24+
sed -i "s/= dev/= ${{ steps.v.outputs.VERSION }}/" setup.cfg
25+
1926
- name: Install pypa/build
2027
run: >-
2128
python -m
2229
pip install
2330
build
2431
--user
32+
2533
- name: Build a binary wheel and a source tarball
2634
run: >-
2735
python -m
@@ -30,8 +38,20 @@ jobs:
3038
--wheel
3139
--outdir dist/
3240
.
41+
42+
- name: 🚀 Upload Release Asset
43+
if: startsWith(github.ref, 'refs/tags/v')
44+
uses: actions/upload-release-asset@v1
45+
env:
46+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
47+
with:
48+
upload_url: ${{ github.event.release.upload_url }}
49+
asset_path: dist/qfieldcloud_sdk-${{ steps.v.outputs.VERSION }}-py3-none-any.whl
50+
asset_name: dist/qfieldcloud_sdk-${{ steps.v.outputs.VERSION }}-py3-none-any.whl
51+
asset_content_type: application/binary
52+
3353
- name: Publish distribution 📦 to PyPI
34-
if: startsWith(github.ref, 'refs/tags')
54+
if: startsWith(github.ref, 'refs/tags/v')
3555
uses: pypa/gh-action-pypi-publish@master
3656
with:
3757
password: ${{ secrets.PYPI_API_TOKEN }}

0 commit comments

Comments
 (0)