Repository navigation
71 lines (67 loc) · 1.83 KB
/
Copy pathrelease.yml
File metadata and controls
71 lines (67 loc) · 1.83 KB
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
name: Release
on:
push:
tags: ["v*"]
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
persist-credentials: false
- uses: actions/setup-python@v6
with:
python-version: "3.13"
- name: Check the tag matches the package version
if: github.event_name == 'push'
run: |
version=$(python -c "import re, pathlib; print(re.search(r'__version__ = \"(.+?)\"', pathlib.Path('instapaper/__init__.py').read_text()).group(1))")
if [ "v$version" != "$GITHUB_REF_NAME" ]; then
echo "Tag $GITHUB_REF_NAME doesn't match __version__ $version"
exit 1
fi
- name: Install
run: pip install -e ".[dev]" build twine
- name: Test
run: pytest
- name: Build
run: |
python -m build
twine check dist/*
- uses: actions/upload-artifact@v5
with:
name: dist
path: dist/
publish-testpypi:
if: github.event_name == 'workflow_dispatch'
needs: build
runs-on: ubuntu-latest
environment:
name: testpypi
url: https://test.pypi.org/p/instapaper-api
permissions:
id-token: write
steps:
- uses: actions/download-artifact@v6
with:
name: dist
path: dist/
- uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/
publish:
if: github.event_name == 'push'
needs: build
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/instapaper-api
permissions:
id-token: write
steps:
- uses: actions/download-artifact@v6
with:
name: dist
path: dist/
- uses: pypa/gh-action-pypi-publish@release/v1