-
Notifications
You must be signed in to change notification settings - Fork 42
89 lines (83 loc) · 2.57 KB
/
release.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
name: Build & Publish Package
on:
push:
tags:
- '*'
release:
types:
- published
concurrency:
group: ${{ github.event_name }}_${{ github.ref_name }}
permissions:
contents: read
id-token: write
jobs:
# Build and verify wheels
build:
name: Build & Verify Package
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Clean
run: |
python -c 'import shutil; [shutil.rmtree(p, True) for p in ("build", "dist")]'
python -c 'import pathlib, shutil; [shutil.rmtree(p, True) for p in pathlib.Path(".").glob("*.egg-info")]'
- name: Create Wheel and Dist
run: |
pip install build
python -m build --sdist --wheel --outdir dist/ .
ls -lat dist
- name: Check Wheel
shell: bash
run: |
pip install check-wheel-contents
check-wheel-contents dist/*.whl
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: Dist_${{ github.ref_name }}
path: dist
# Upload to Test PyPI on every tag
release-test-pypi:
needs: build
name: Publish PyPI TEST
environment: release-test-pypi
if: github.repository_owner == 'emdgroup' && github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
runs-on: ubuntu-latest
steps:
- name: Download packages built
uses: actions/download-artifact@v4
with:
name: Dist_${{ github.ref_name }}
path: dist
- name: Upload package to Test PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/
# Upload to real PyPI on GitHub Releases.
release-pypi:
needs: build
name: Publish PyPI PROD
environment: release-pypi
if: github.repository_owner == 'emdgroup' && github.event.action == 'published'
runs-on: ubuntu-latest
steps:
- uses: actions/setup-python@v5
id: setup-python
with:
python-version: '3.12'
- name: Install test-package
run: |
pip install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple/ baybe==${{ github.ref_name }}
- name: Download packages built
uses: actions/download-artifact@v4
with:
name: Dist_${{ github.ref_name }}
path: dist
- name: Upload package to PyPI
uses: pypa/gh-action-pypi-publish@release/v1