-
Notifications
You must be signed in to change notification settings - Fork 20
77 lines (69 loc) · 2.04 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
# This workflow will build a Python project using sdist bdist_wheel
# and publish to PyPI.
name: Publish
on:
push:
tags:
- 'v*'
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
env:
ARTIFACT_NAME: torch_ecg_dist
ARTIFACT_DIR: dist
# OS_NAME_VERSION: ubuntu-latest
jobs:
build:
# Don't run on forked repos.
if: github.repository_owner == 'DeepPSP'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.x'
cache: 'pip' # caching pip dependencies
- name: List existing Python packages
run: |
python -m pip list
- name: Install dependencies
run: |
python -m pip install --upgrade pip setuptools wheel
pip install -r requirements.txt
- name: List installed Python packages
run: |
python -m pip list
- name: Build
run: |
python setup.py sdist bdist_wheel
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: $ARTIFACT_NAME
path: dist
pypi-publish:
# publishing is separate from building
needs: build
name: Upload release to PyPI
runs-on: ubuntu-latest
environment:
name: release
permissions:
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
steps:
- name: Download artifact
uses: actions/download-artifact@v3
with:
name: $ARTIFACT_NAME
path: $ARTIFACT_DIR
- name: Publish package to TestPyPI # to test, use https://test.pypi.org/
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.TEST_PYPI_TOKEN }}
repository-url: https://test.pypi.org/legacy/
packages-dir: $ARTIFACT_DIR
- name: Publish package to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_TORCH_ECG_TOKEN }}
packages-dir: $ARTIFACT_DIR