-
-
Notifications
You must be signed in to change notification settings - Fork 0
70 lines (58 loc) · 2.13 KB
/
publish-to-test-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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
# Source: https://packaging.python.org/en/latest/guides/publishing-package-distribution-releases-using-github-actions-ci-cd-workflows/
name: Publish Python 🐍 distributions 📦 to PyPI and TestPyPI
on:
push:
branches:
- main
tags:
- 'v[0-9]+.[0-9]+.[0-9]+**'
jobs:
build-n-publish:
name: Build and publish Python 🐍 distributions 📦 to PyPI and TestPyPI
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/')
steps:
- name: "🛒 Checkout repository"
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: "🐍 Install Python"
uses: actions/setup-python@v5
with:
python-version: '3.9'
- uses: actions/cache@v3
with:
key: ${{ github.ref }}
path: .cache
- name: "📜 Install Poetry"
uses: abatilo/actions-poetry@v2
with:
poetry-version: 1.3.2
- name: "🔍 Install dependencies"
run: poetry install --with dev
- name: 📷 Replace image URLs
run: sed -i '/\.png/s_](_](https://raw.githubusercontent.com/LukeSavefrogs/wsadmin-type-hints/main/_' README.md
# Source: https://stackoverflow.com/a/67569812/8965861
# TODO: Replace ONLY local URLs
# - name: 📷 Replace image URLs
# run: |
# sed -r -i '
# /\]\(.*?\.png/ {
# s_\]\(_\]\(https://raw.githubusercontent.com/LukeSavefrogs/wsadmin-type-hints/main/_;
# }' README.md
# gawk '
# /\]\(.*?\.png.*?\)/ {
# }
# ' README.md
- name: "📚 Deploy"
run: poetry build --no-interaction --no-cache
# - name: Publish distribution 📦 to Test PyPI
# uses: pypa/gh-action-pypi-publish@release/v1
# with:
# password: ${{ secrets.TEST_PYPI_API_TOKEN }}
# repository_url: https://test.pypi.org/legacy/
- name: Publish distribution 📦 to PyPI
if: startsWith(github.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_API_TOKEN }}