forked from fossasia/visdom
-
Notifications
You must be signed in to change notification settings - Fork 0
54 lines (51 loc) · 1.77 KB
/
pypi.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
name: Deploy to PyPI
on:
push:
branches:
- master
paths:
- 'py/visdom/VERSION'
jobs:
deploy:
runs-on: ubuntu-latest
name: "Deploy to PyPI"
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Get git-tags
run: |
git fetch --prune --unshallow --tags
git tag --list
- name: Retrieve version
run: |
echo "::set-output name=TAG_NAME::$(cat py/visdom/VERSION)"
echo "::set-output name=TAG_EXISTS::$(git tag | grep v$(cat py/visdom/VERSION) | wc -l)"
id: version
- name: Show version
run: |
echo "Version name: ${{ steps.version.outputs.TAG_NAME }}"
echo "Existing Matching Tags: ${{ steps.version.outputs.TAG_EXISTS }}"
- name: Create Release
if: ${{ steps.version.outputs.TAG_EXISTS == '0' }}
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: v${{ steps.version.outputs.TAG_NAME }}
release_name: "Release ${{ steps.version.outputs.TAG_NAME }}"
- name: Set up Python
if: ${{ steps.version.outputs.TAG_EXISTS == '0' }}
uses: actions/setup-python@v4
with:
python-version: '3.x'
- name: Install dependencies
if: ${{ steps.version.outputs.TAG_EXISTS == '0' }}
run: python setup.py sdist
- name: Publish a Python distribution to PyPI
if: ${{ steps.version.outputs.TAG_EXISTS == '0' }}
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.pypi_password }}
# Guide: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions