-
Notifications
You must be signed in to change notification settings - Fork 122
107 lines (86 loc) · 2.74 KB
/
release_n_deploy.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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
name: release-n-deploy
on:
push:
tags:
- "v*.*" # Trigger on push with tags matching a version, e.g.: v1.0, v0.1.5
jobs:
deploy-test-pypi:
name: Deploy to Test PyPI
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.x"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine
- name: Build
run: python setup.py sdist bdist_wheel
- name: Twine check
run: twine check dist/*
- name: Upload package artifacts
uses: actions/upload-artifact@v4
with:
name: package-artifacts
path: dist/
- name: Publish package to PyPI
uses: pypa/gh-action-pypi-publish@v1
with:
password: ${{ secrets.test_pypi_password }}
repository_url: https://test.pypi.org/legacy/
- name: Sleep for 120 seconds to give Test PyPI time to update the search index
run: sleep 120
verify-test-pypi:
name: Install from Test PyPI
runs-on: ubuntu-latest
needs: [deploy-test-pypi]
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.x"
- name: Get release version
id: release_version
run: |
echo "version=${GITHUB_REF#refs/*/}" >> "$GITHUB_OUTPUT"
echo ${{ steps.release_version.outputs.version }}
- name: Install torch-lr-finder ${{ steps.release_version.outputs.version }} from Test PyPI
run: |
python -m pip install --upgrade pip
pip install \
--index-url https://test.pypi.org/simple/ \
--extra-index-url https://pypi.org/simple \
torch-lr-finder==${{ steps.release_version.outputs.version }}
release:
name: Create Release
runs-on: ubuntu-latest
needs: [verify-test-pypi]
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Create draft release
run: |
gh release create ${{ github.ref }} \
--title "Release ${{ github.ref }}" \
--generate-notes \
--draft
deploy-pypi:
name: Deploy to PyPI
runs-on: ubuntu-latest
needs: [verify-test-pypi]
steps:
- name: Download package artifacts
uses: actions/download-artifact@v4
with:
name: package-artifacts
path: dist/
# - name: Publish package to PyPI
# uses: pypa/gh-action-pypi-publish@v1
# with:
# password: ${{ secrets.pypi_password }}