-
Notifications
You must be signed in to change notification settings - Fork 6
74 lines (70 loc) · 2.1 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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
name: Publish Python 🐍 distribution 📦 to PyPI and TestPyPI
on:
push:
tags:
- v* # Push tags to trigger the workflow
pull_request:
types: [closed]
branches:
- develop
workflow_dispatch:
inputs:
test:
description: "Push to TestPyPI not PyPI"
default: true
type: boolean
jobs:
Build-and-publish-to-Test-PyPI:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: '0'
- name: Set up Poetry 📦
uses: JRubics/[email protected]
with:
pypi_token: ${{ secrets.TEST_PYPI_API_TOKEN }}
plugins: "poetry-dynamic-versioning"
repository_name: "scraibe"
repository_url: "https://test.pypi.org/legacy/"
test-install:
name: Test Installation from TestPyPI
needs: Build-and-publish-to-Test-PyPI
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.9, 3.11, 3.12]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install package
run: |
pip install -U setuptools
pip install -r requirements.txt
python3 -m pip install --no-deps --pre --index-url https://test.pypi.org/simple/ scraibe>=0.1.3
python3 -c "import scraibe; print(scraibe.__version__)"
publish-to-pypi:
name: Publish to PyPI
needs: test-install
runs-on: ubuntu-latest
steps:
- name: Checkout Repository Tags
uses: actions/checkout@v4
with:
fetch-depth: '0'
branch: 'main'
- name: Checkout Repository (Develop)
uses: actions/checkout@v4
if: github.ref == 'refs/heads/develop'
with:
fetch-depth: '0'
branch: 'develop'
- name: Set up Poetry 📦
uses: JRubics/[email protected]
with:
pypi_token: ${{ secrets.PYPI_API_TOKEN }}
plugins: "poetry-dynamic-versioning"
repository_name: "scraibe"