-
Notifications
You must be signed in to change notification settings - Fork 1
83 lines (71 loc) · 2.79 KB
/
preview.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
# This is a workflow for previewing packages. It can be used for testing before a release to the "production" systems.
# It will automatically create developmental release builds and make them available for all pushes to `main`. There is
# also an ability to manually trigger this workflow, with an additional option to publish the package to TestPyPI.
---
name: Preview
on:
# Allow running this workflow manually from the Actions tab
workflow_dispatch:
inputs:
TestPyPI:
description: "Publish to TestPyPI"
type: boolean
required: true
default: false
push:
branches:
- main
jobs:
publish_preview:
name: Build and Publish for Preview
runs-on: ubuntu-latest
strategy:
matrix:
# It's only one Python version specified in a "matrix", but on purpose to stay DRY
python-version: ["3.11"]
defaults:
run:
shell: bash
steps:
- name: Checkout the repo
uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0
with:
# `python-semantic-release` needs full history to properly determine the next release version
fetch-depth: 0
- name: Install poetry
run: pipx install poetry==1.6.1
- name: Configure poetry
run: |
poetry config virtualenvs.in-project true
poetry config repositories.testpypi https://test.pypi.org/legacy/
- name: Set up Python
uses: actions/setup-python@65d7f2d534ac1bc67fcd62888c5f4f3d2cb2b236 # v4.7.1
with:
python-version: ${{ matrix.python-version }}
cache: 'poetry'
- name: Install the project with poetry
run: |
poetry env use python${{ matrix.python-version }}
poetry check --lock
poetry lock --no-update --no-cache
poetry install --verbose --no-root --sync --with test,ci
- name: Make developmental release version
# poetry version rules do not provide for developmental releases as specified in PEP440.
# It can be pieced together with these commands.
run: |
poetry version "$(poetry run semantic-release print-version --next)"
poetry version "$(poetry version --short).dev${GITHUB_RUN_NUMBER}"
- name: Run tox via poetry
run: poetry run tox
- name: Build wheel and source distribution
run: poetry build -vvv
- name: Upload build artifacts
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3
with:
name: dist
path: ./dist/
if-no-files-found: error
retention-days: 7
- name: Publish to TestPyPI
if: inputs.TestPyPI
run: poetry publish --repository testpypi --username __token__ --password ${{ secrets.TESTPYPI_API_TOKEN }}